public async Task <IActionResult> OnPostAsync() { if (ModelState.IsValid) { RegisterModel.InputModel userEmail = collection.Find(e => e.Email == Input.Email).FirstOrDefault(); if (userEmail == null) { // Don't reveal that the user does not exist or is not confirmed return(RedirectToPage("./ForgotPasswordConfirmation")); } return(RedirectToPage("./ResetPassword")); } return(Page()); }
public IActionResult OnPost(InputModel input, string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); if (ModelState.IsValid) { var email = input.Email; var password = encryptpass(input.Password); string encryptpass(string password) { string msg = ""; byte[] encode = new byte[password.Length]; encode = Encoding.UTF8.GetBytes(password); msg = Convert.ToBase64String(encode); return(msg); } RegisterModel.InputModel userEmail = collection.Find(e => e.Email == email).FirstOrDefault(); if (userEmail != null) { RegisterModel.InputModel userPassword = collection.Find(e => e.Password == password).FirstOrDefault(); if (userPassword != null) { TempData["Name"] = (userPassword.FirstName + userPassword.LastName); return(RedirectToAction("Index", "Home", new { area = "Employee" })); } else { ModelState.AddModelError(string.Empty, "Invalid Credentials"); } } else { ModelState.AddModelError(string.Empty, "Invalid Credentials"); } } // If we got this far, something failed, redisplay form return(Page()); }