public async Task AuthenticateUserForResetAsync_DatabaseUser_EmptyLogin_InvalidCredentialException() { // Arrange // Act await _authenticationRepository.AuthenticateUserForResetAsync("", Password); // Assert // Exception }
public async Task <IHttpActionResult> PostReset(string login, [FromBody] ResetPostContent body) { string decodedLogin; string decodedOldPassword; string decodedNewPassword; try { decodedLogin = SystemEncryptions.Decode(login); } catch (Exception) { throw new BadRequestException("provided login is invalid"); } try { decodedOldPassword = SystemEncryptions.Decode(body.OldPass); } catch (Exception) { throw new BadRequestException("provided old password is invalid"); } try { decodedNewPassword = SystemEncryptions.Decode(body.NewPass); } catch (Exception) { throw new BadRequestException("provided new password is invalid"); } var user = await _authenticationRepository.AuthenticateUserForResetAsync(decodedLogin, decodedOldPassword); await _authenticationRepository.ResetPassword(user, decodedOldPassword, decodedNewPassword); return(Ok()); }