|
|
@@ -326,7 +326,6 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) { |
|
|
|
return |
|
|
|
} |
|
|
|
models.SaveLoginInfoToDb(ctx.Req.Request, u) |
|
|
|
log.Info("here333") |
|
|
|
// 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) |
|
|
@@ -338,7 +337,6 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) { |
|
|
|
} |
|
|
|
return |
|
|
|
} |
|
|
|
log.Info("here444") |
|
|
|
// 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) |
|
|
@@ -370,7 +368,6 @@ func SignInCloudBrainPost(ctx *context.Context, form auth.SignInForm) { |
|
|
|
|
|
|
|
// SignInPost response for sign in request |
|
|
|
func SignInPost(ctx *context.Context, form auth.SignInForm) { |
|
|
|
log.Info("here99999") |
|
|
|
ctx.Data["PageIsLogin"] = true |
|
|
|
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login" |
|
|
|
ctx.Data["ActivityTpl"] = getActivityTpl() |
|
|
@@ -750,7 +747,6 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR |
|
|
|
|
|
|
|
// Register last login |
|
|
|
u.SetLastLogin() |
|
|
|
log.Info("77777_2222") |
|
|
|
if err := models.UpdateUserCols(u, "last_login_unix"); err != nil { |
|
|
|
ctx.ServerError("UpdateUserCols", err) |
|
|
|
return setting.AppSubURL + "/dashboard" |
|
|
@@ -762,16 +758,13 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR |
|
|
|
ctx.RedirectToFirst(redirectToCourse) |
|
|
|
return redirectToCourse |
|
|
|
} |
|
|
|
log.Info("77777_777") |
|
|
|
if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 && !util.IsExternalURL(redirectTo) { |
|
|
|
log.Info("77777_8888") |
|
|
|
ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL, "", setting.SessionConfig.Secure, true) |
|
|
|
if obeyRedirect { |
|
|
|
ctx.RedirectToFirst(redirectTo) |
|
|
|
} |
|
|
|
return redirectTo |
|
|
|
} |
|
|
|
log.Info("77777_99999") |
|
|
|
if obeyRedirect { |
|
|
|
ctx.Redirect(setting.AppSubURL + "/dashboard") |
|
|
|
} |
|
|
|