|
|
@@ -215,6 +215,7 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) { |
|
|
|
} |
|
|
|
return |
|
|
|
} |
|
|
|
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) |
|
|
@@ -226,7 +227,6 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) { |
|
|
|
} |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 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) |
|
|
@@ -240,7 +240,6 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) { |
|
|
|
ctx.ServerError("UserSignIn: Unable to save session", err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
regs, err := models.GetU2FRegistrationsByUID(u.ID) |
|
|
|
if err == nil && len(regs) > 0 { |
|
|
|
ctx.Redirect(setting.AppSubURL + "/user/u2f") |
|
|
@@ -1168,8 +1167,8 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo |
|
|
|
log.Trace("Account created: %s", u.Name, ctx.Data["MsgID"]) |
|
|
|
|
|
|
|
err := models.AddEmailAddress(&models.EmailAddress{ |
|
|
|
UID: u.ID, |
|
|
|
Email: form.Email, |
|
|
|
UID: u.ID, |
|
|
|
Email: form.Email, |
|
|
|
IsActivated: !setting.Service.RegisterEmailConfirm, |
|
|
|
}) |
|
|
|
|
|
|
@@ -1267,7 +1266,7 @@ func Activate(ctx *context.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
email, err := models.GetEmailAddressByIDAndEmail(user.ID, user.Email) |
|
|
|
if err != nil || email == nil{ |
|
|
|
if err != nil || email == nil { |
|
|
|
log.Error("GetEmailAddressByIDAndEmail failed", ctx.Data["MsgID"]) |
|
|
|
} else { |
|
|
|
if err := email.Activate(); err != nil { |
|
|
|