public IActionResult ResetAdmin(string token, string password) { bool success = false; try { success = AccountRecoveryService.RedeemResetToken(password, token, true); } catch (Exception ex) { return(Json(new { success = false, error = "An unknown error occured" })); } if (success) { return(Json(new { success = true, redirect = "/admin/login" })); } return(Json(new { success = false, error = "An unknown error occured" })); }
public IActionResult RequestAdminToken(string email) { try { AccountRecoveryService.RequestResetToken(email.ToLower(), true); return(Json(new { success = true, data = "Success! Check your inbox for further instructions." })); } catch (Exception ex) { return(Json(new { success = false, error = ex.Message })); } }
public IActionResult ResetAdmin(string token) { try { var user = new Tenant(); var tokenIsValid = AccountRecoveryService.ValidateResetToken(token, true); if (tokenIsValid) { return(View("~/Views/Auth/ResetAdminPassword.cshtml")); } //If invalid token, prompt user for email. return(View("~/Views/Auth/RequestAdminToken.cshtml")); } catch (Exception ex) { throw ex; } }