public ActionResult SignIn(SignInModel model) { try { SignInResult result = AccountsManager.Authenticate(model.Username, model.Password); if (result.Ok) { // Set the authentication cookie FormsAuthentication.SetAuthCookie(result.Username, true); } else { return(CreateValidationError(result.Reason)); } return(JsonOK()); } catch (Exception ex) { EventLog.WriteEntry("Krypto", "An error occured while trying to sign-in: " + ex.Message); return(CreateValidationError("Internal Server Error")); } }
public ActionResult ChangePassword(ChangePasswordModel model) { if (AccountsManager.Authenticate(Username, model.OldPassword).Ok) { AccountsManager.SetAccountPassword(Username, model.NewPassword); return(JsonOK()); } else { return(CreateValidationError("OldPassword", "Incorrect password")); } }