Browse Source

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

tags/2.0.3
Teknikode 4 years ago
parent
commit
e1c8d426df
1 changed files with 6 additions and 4 deletions
  1. 6
    4
      Teknik/Areas/User/Controllers/UserController.cs

+ 6
- 4
Teknik/Areas/User/Controllers/UserController.cs View File

@@ -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…
Cancel
Save