Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.21.12.1
zouap 3 years ago
parent
commit
c1b3feaed8
1 changed files with 2 additions and 6 deletions
  1. +2
    -6
      routers/user/auth.go

+ 2
- 6
routers/user/auth.go View File

@@ -215,7 +215,7 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
} }
return return
} }
log.Info("Go this 1.")
models.SaveLoginInfoToDb(ctx.Req.Request, u)
// If this user is enrolled in 2FA, we can't sign the user in just yet. // If this user is enrolled in 2FA, we can't sign the user in just yet.
// Instead, redirect them to the 2FA authentication page. // Instead, redirect them to the 2FA authentication page.
_, err = models.GetTwoFactorByUID(u.ID) _, err = models.GetTwoFactorByUID(u.ID)
@@ -225,10 +225,8 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
} else { } else {
ctx.ServerError("UserSignIn", err) ctx.ServerError("UserSignIn", err)
} }
log.Info("Go this 1-1.")
return return
} }
log.Info("Go this 2.")
// User needs to use 2FA, save data and redirect to 2FA page. // User needs to use 2FA, save data and redirect to 2FA page.
if err := ctx.Session.Set("twofaUid", u.ID); err != nil { if err := ctx.Session.Set("twofaUid", u.ID); err != nil {
ctx.ServerError("UserSignIn: Unable to set twofaUid in session", err) ctx.ServerError("UserSignIn: Unable to set twofaUid in session", err)
@@ -242,14 +240,12 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
ctx.ServerError("UserSignIn: Unable to save session", err) ctx.ServerError("UserSignIn: Unable to save session", err)
return return
} }
log.Info("Go this 3.")
regs, err := models.GetU2FRegistrationsByUID(u.ID) regs, err := models.GetU2FRegistrationsByUID(u.ID)
if err == nil && len(regs) > 0 { if err == nil && len(regs) > 0 {
ctx.Redirect(setting.AppSubURL + "/user/u2f") ctx.Redirect(setting.AppSubURL + "/user/u2f")
return return
} }
log.Info("Go this 4.")
models.SaveLoginInfoToDb(ctx.Req.Request, u)

ctx.Redirect(setting.AppSubURL + "/user/two_factor") ctx.Redirect(setting.AppSubURL + "/user/two_factor")
} }




Loading…
Cancel
Save