Skip to content

Commit d087f4f

Browse files
authored
Sign: Handle ErrTwoFactorNotEnrolled correctly (#10008)
1 parent 20d637a commit d087f4f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

models/pull_sign.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (pr *PullRequest) SignMerge(u *User, tmpBasePath, baseCommit, headCommit st
4343
}
4444
case twofa:
4545
twofaModel, err := GetTwoFactorByUID(u.ID)
46-
if err != nil {
46+
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
4747
return false, "", err
4848
}
4949
if twofaModel == nil {

models/repo_sign.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func SignInitialCommit(repoPath string, u *User) (bool, string, error) {
119119
}
120120
case twofa:
121121
twofaModel, err := GetTwoFactorByUID(u.ID)
122-
if err != nil {
122+
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
123123
return false, "", err
124124
}
125125
if twofaModel == nil {
@@ -154,7 +154,7 @@ func (repo *Repository) SignUncycloCommit(u *User) (bool, string, error) {
154154
}
155155
case twofa:
156156
twofaModel, err := GetTwoFactorByUID(u.ID)
157-
if err != nil {
157+
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
158158
return false, "", err
159159
}
160160
if twofaModel == nil {
@@ -206,7 +206,7 @@ func (repo *Repository) SignCRUDAction(u *User, tmpBasePath, parentCommit string
206206
}
207207
case twofa:
208208
twofaModel, err := GetTwoFactorByUID(u.ID)
209-
if err != nil {
209+
if err != nil && !IsErrTwoFactorNotEnrolled(err) {
210210
return false, "", err
211211
}
212212
if twofaModel == nil {

0 commit comments

Comments
 (0)