From d087f4fb735d860a394baf709f4cac5b945f9287 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 26 Jan 2020 23:44:12 +0000 Subject: [PATCH] Sign: Handle ErrTwoFactorNotEnrolled correctly (#10008) --- models/pull_sign.go | 2 +- models/repo_sign.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/models/pull_sign.go b/models/pull_sign.go index 6ac21527222..5b26b4bdc9e 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 8913620fa06..c728a2911a1 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 {