Skip to content

Commit 931a766

Browse files
committed
add back missed codes
1 parent c16e583 commit 931a766

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

routers/web/auth/2fa.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import (
1616
"code.gitea.io/gitea/modules/web"
1717
"code.gitea.io/gitea/services/externalaccount"
1818
"code.gitea.io/gitea/services/forms"
19-
20-
"github.com/markbates/goth"
2119
)
2220

2321
var (
@@ -78,13 +76,7 @@ func TwoFactorPost(ctx *context.Context) {
7876
}
7977

8078
if ctx.Session.Get("linkAccount") != nil {
81-
gothUser := ctx.Session.Get("linkAccountGothUser")
82-
if gothUser == nil {
83-
ctx.ServerError("UserSignIn", errors.New("not in LinkAccount session"))
84-
return
85-
}
86-
87-
err = externalaccount.LinkAccountToUser(u, gothUser.(goth.User))
79+
err = externalaccount.LinkAccountFromStore(ctx.Session, ctx.User)
8880
if err != nil {
8981
ctx.ServerError("UserSignIn", err)
9082
return

routers/web/auth/oauth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ func handleOAuth2SignIn(ctx *context.Context, source *auth.Source, u *user_model
995995
cols = append(cols, "is_admin", "is_restricted")
996996
}
997997

998-
if err := user_model.UpdateUserCols(db.DefaultContext, u, "last_login_unix"); err != nil {
998+
if err := user_model.UpdateUserCols(db.DefaultContext, u, cols...); err != nil {
999999
ctx.ServerError("UpdateUserCols", err)
10001000
return
10011001
}

0 commit comments

Comments
 (0)