瀏覽代碼

Moved user transfer to once login auth passed, but before two factor. Also moved last seen.

tags/2.0.3
Teknikode 5 年之前
父節點
當前提交
e1c8d426df
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6
    4
      Teknik/Areas/User/Controllers/UserController.cs

+ 6
- 4
Teknik/Areas/User/Controllers/UserController.cs 查看文件

@@ -168,6 +168,12 @@ namespace Teknik.Areas.Users.Controllers
bool userValid = UserHelper.UserPasswordCorrect(db, Config, user, model.Password);
if (userValid)
{
// Perform transfer actions on the account
UserHelper.TransferUser(db, Config, user, model.Password);
user.LastSeen = DateTime.Now;
db.Entry(user).State = EntityState.Modified;
db.SaveChanges();

bool twoFactor = false;
string returnUrl = model.ReturnUrl;
if (user.SecuritySettings.TwoFactorEnabled)
@@ -202,10 +208,6 @@ namespace Teknik.Areas.Users.Controllers
{
returnUrl = Request.UrlReferrer.AbsoluteUri.ToString();
// They don't need two factor auth.
UserHelper.TransferUser(db, Config, user, model.Password);
user.LastSeen = DateTime.Now;
db.Entry(user).State = EntityState.Modified;
db.SaveChanges();
HttpCookie authcookie = UserHelper.CreateAuthCookie(model.Username, model.RememberMe, Request.Url.Host.GetDomain(), Request.IsLocal);
Response.Cookies.Add(authcookie);
}

Loading…
取消
儲存