Browse Source

Sign: Handle ErrTwoFactorNotEnrolled correctly (#10008)

for-closed-social
zeripath 4 years ago
committed by GitHub
parent
commit
d087f4fb73
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions
  1. +1
    -1
      models/pull_sign.go
  2. +3
    -3
      models/repo_sign.go

+ 1
- 1
models/pull_sign.go View File

@ -43,7 +43,7 @@ func (pr *PullRequest) SignMerge(u *User, tmpBasePath, baseCommit, headCommit st
}
case twofa:
twofaModel, err := GetTwoFactorByUID(u.ID)
if err != nil {
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
return false, "", err
}
if twofaModel == nil {

+ 3
- 3
models/repo_sign.go View File

@ -119,7 +119,7 @@ func SignInitialCommit(repoPath string, u *User) (bool, string, error) {
}
case twofa:
twofaModel, err := GetTwoFactorByUID(u.ID)
if err != nil {
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
return false, "", err
}
if twofaModel == nil {
@ -154,7 +154,7 @@ func (repo *Repository) SignWikiCommit(u *User) (bool, string, error) {
}
case twofa:
twofaModel, err := GetTwoFactorByUID(u.ID)
if err != nil {
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
return false, "", err
}
if twofaModel == nil {
@ -206,7 +206,7 @@ func (repo *Repository) SignCRUDAction(u *User, tmpBasePath, parentCommit string
}
case twofa:
twofaModel, err := GetTwoFactorByUID(u.ID)
if err != nil {
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
return false, "", err
}
if twofaModel == nil {

Loading…
Cancel
Save