aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-01-26 23:44:12 +0000
committerGitHub <noreply@github.com>2020-01-26 23:44:12 +0000
commitd087f4fb735d860a394baf709f4cac5b945f9287 (patch)
treee2a49398d9cedbbf283fd040c424281af0aa0290 /models
parent20d637a0f834a4ed50dd87bce496be5e1604986b (diff)
downloadgitea-d087f4fb735d860a394baf709f4cac5b945f9287.tar.gz
gitea-d087f4fb735d860a394baf709f4cac5b945f9287.zip
Sign: Handle ErrTwoFactorNotEnrolled correctly (#10008)
Diffstat (limited to 'models')
-rw-r--r--models/pull_sign.go2
-rw-r--r--models/repo_sign.go6
2 files changed, 4 insertions, 4 deletions
diff --git a/models/pull_sign.go b/models/pull_sign.go
index 6ac2152722..5b26b4bdc9 100644
--- a/models/pull_sign.go
+++ b/models/pull_sign.go
@@ -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 {
diff --git a/models/repo_sign.go b/models/repo_sign.go
index 8913620fa0..c728a2911a 100644
--- a/models/repo_sign.go
+++ b/models/repo_sign.go
@@ -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 {