Sign: Handle ErrTwoFactorNotEnrolled correctly (#10008)
This commit is contained in:
parent
20d637a0f8
commit
d087f4fb73
2 changed files with 4 additions and 4 deletions
|
@ -43,7 +43,7 @@ func (pr *PullRequest) SignMerge(u *User, tmpBasePath, baseCommit, headCommit st
|
||||||
}
|
}
|
||||||
case twofa:
|
case twofa:
|
||||||
twofaModel, err := GetTwoFactorByUID(u.ID)
|
twofaModel, err := GetTwoFactorByUID(u.ID)
|
||||||
if err != nil {
|
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
|
||||||
return false, "", err
|
return false, "", err
|
||||||
}
|
}
|
||||||
if twofaModel == nil {
|
if twofaModel == nil {
|
||||||
|
|
|
@ -119,7 +119,7 @@ func SignInitialCommit(repoPath string, u *User) (bool, string, error) {
|
||||||
}
|
}
|
||||||
case twofa:
|
case twofa:
|
||||||
twofaModel, err := GetTwoFactorByUID(u.ID)
|
twofaModel, err := GetTwoFactorByUID(u.ID)
|
||||||
if err != nil {
|
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
|
||||||
return false, "", err
|
return false, "", err
|
||||||
}
|
}
|
||||||
if twofaModel == nil {
|
if twofaModel == nil {
|
||||||
|
@ -154,7 +154,7 @@ func (repo *Repository) SignWikiCommit(u *User) (bool, string, error) {
|
||||||
}
|
}
|
||||||
case twofa:
|
case twofa:
|
||||||
twofaModel, err := GetTwoFactorByUID(u.ID)
|
twofaModel, err := GetTwoFactorByUID(u.ID)
|
||||||
if err != nil {
|
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
|
||||||
return false, "", err
|
return false, "", err
|
||||||
}
|
}
|
||||||
if twofaModel == nil {
|
if twofaModel == nil {
|
||||||
|
@ -206,7 +206,7 @@ func (repo *Repository) SignCRUDAction(u *User, tmpBasePath, parentCommit string
|
||||||
}
|
}
|
||||||
case twofa:
|
case twofa:
|
||||||
twofaModel, err := GetTwoFactorByUID(u.ID)
|
twofaModel, err := GetTwoFactorByUID(u.ID)
|
||||||
if err != nil {
|
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
|
||||||
return false, "", err
|
return false, "", err
|
||||||
}
|
}
|
||||||
if twofaModel == nil {
|
if twofaModel == nil {
|
||||||
|
|
Reference in a new issue