private string GetResetKey(string email) { var uuid = Guid.NewGuid(); ResetContext resetContext = HttpContext.RequestServices.GetService(typeof(ResetContext)) as ResetContext; UserContext userContext = HttpContext.RequestServices.GetService(typeof(UserContext)) as UserContext; var userId = userContext.GetUserId(email); if (userId == -1) { return(""); } resetContext.SetKey(userId, uuid.ToString()); return(uuid.ToString()); }
public IActionResult CheckLink(string key) { ResetContext resetContext = HttpContext.RequestServices.GetService(typeof(ResetContext)) as ResetContext; int userId = resetContext.CheckKey(key); if (userId == -1) { return(Content("Key does not match or is expired")); } else { resetContext.removeKey(userId); ViewData["userId"] = userId; return(View()); } }
public void SetUp() { ResetContext.Reset(contextIntegrationTests); unitOfWorkTest = new UnitOfWork(contextIntegrationTests); user = CreateUser(); }
public HomeController(PrincipalContext DomainContext, SmtpClient smtpClient, ResetContext db) { _context = DomainContext; _smtpClient = smtpClient; _DbContext = db; }