public async Task <ActionResult> Index(string email, string password) { AppUser _loggedInUser = await AppManager.AuthenticateUserAsync(email, password); if (_loggedInUser != null) { Session["ICO_Administrator"] = _loggedInUser; var uaParser = Parser.GetDefault(); ClientInfo _clientInfo = uaParser.Parse(Request.UserAgent); AdministratorSession _session = await db.AdministratorSessions.FirstOrDefaultAsync(u => u.ID == _loggedInUser.SessionID && u.AdministratorID == _loggedInUser.ID && u.IsActive); string _body = $"Hello {_loggedInUser.Name ?? _loggedInUser.Email.ToLower()},<br /><br />Your Seratio Platform Administrative account was just used to sign in from {_clientInfo.UserAgent.Family} on {_clientInfo.OS.Family}.<br />.If not you<br />Please <a href='{AppManager.AppURL}/L0C5A3E8915871B710C2CC98073748424/default/TerminateSession?token={_session.Token}'>click here</a> to deny access your Account.<br/><br/>Regards,<br/>CCEG<br/>"; AppManager.SendEmail($"New sign-in from {_clientInfo.UserAgent.Family} {_clientInfo.UserAgent.Major} on {_clientInfo.OS.Family} {_clientInfo.OS.Major}", _loggedInUser.Email, _body); return(Redirect("/L0C5A3E8915871B710C2CC98073748424/default/dashboard")); } else { TempData["Notification"] = new Notification("Error", "Email and password do not match. Please try again."); return(View()); } }
public async Task <ActionResult> Index(string username, string password, bool remindme = false) { var _loggedInCandidate = await AppManager.AuthenticateUserAsync(username.ToLower(), password); if (_loggedInCandidate != null) { Session["Blockchain_User"] = _loggedInCandidate; return(RedirectToAction("dashboard", "default")); } else { TempData["Notification"] = new Notification("Error", "Email and password do not match. Please try again."); return(View()); } }