public async Task <HttpResponseMessage> Put(ResetPasswordModel model) { // Check recovery link RecoveryLink link = _passwordRecoveryService.GetLink(model.E, model.I); if (link.ExpirationDate == DateTime.MinValue) { // If wrong '?i=' param don't show LinkExpired page return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ResponseMessages.ResourceNotFound)); } if (link.ExpirationDate <= DateTime.UtcNow) { // link expired return(Request.CreateErrorResponse(HttpStatusCode.Gone, ResponseMessages.ResourceGone)); } // Change password await _passwordRecoveryService.ChangePassword(link, model.Password); return(Request.CreateResponse(HttpStatusCode.OK)); }
public async Task ChangePassword([FromBody] PasswordRecoveryModel model) { await _recoveryService.ChangePassword(model.Token, model.NewPassword); }