|
|
@@ -215,7 +215,7 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) { |
|
|
|
} |
|
|
|
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. |
|
|
|
// Instead, redirect them to the 2FA authentication page. |
|
|
|
_, err = models.GetTwoFactorByUID(u.ID) |
|
|
@@ -225,10 +225,8 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) { |
|
|
|
} else { |
|
|
|
ctx.ServerError("UserSignIn", err) |
|
|
|
} |
|
|
|
log.Info("Go this 1-1.") |
|
|
|
return |
|
|
|
} |
|
|
|
log.Info("Go this 2.") |
|
|
|
// User needs to use 2FA, save data and redirect to 2FA page. |
|
|
|
if err := ctx.Session.Set("twofaUid", u.ID); err != nil { |
|
|
|
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) |
|
|
|
return |
|
|
|
} |
|
|
|
log.Info("Go this 3.") |
|
|
|
regs, err := models.GetU2FRegistrationsByUID(u.ID) |
|
|
|
if err == nil && len(regs) > 0 { |
|
|
|
ctx.Redirect(setting.AppSubURL + "/user/u2f") |
|
|
|
return |
|
|
|
} |
|
|
|
log.Info("Go this 4.") |
|
|
|
models.SaveLoginInfoToDb(ctx.Req.Request, u) |
|
|
|
|
|
|
|
ctx.Redirect(setting.AppSubURL + "/user/two_factor") |
|
|
|
} |
|
|
|
|
|
|
|