public void The_wallet_password_hash_is_verifiable(string passphrase) { Wallet wallet1 = _provider.Value.Create(passphrase); Wallet wallet2 = _provider.Value.Create(passphrase); Assert.True(PasswordUtil.Verify(passphrase, wallet1.PasswordHash)); Assert.True(PasswordUtil.Verify(passphrase, wallet2.PasswordHash)); }
public async Task <Wallet> CheckWalletPasswordAsync(string id, string password) { var wallet = await GetWalletByIdAsync(id); if (wallet != null && PasswordUtil.Verify(password, wallet.PasswordHash)) { return(wallet); } return(null); }
public async Task<UserLoginResponseDto> Login(string email, string password) { var user = await userRepository.GetUser(email); if (user != null && PasswordUtil.Verify(password, user.Password)) { var token = tokenService.GenerateToken(user); return new UserLoginResponseDto(token); } return null; }
public async Task <CommandResult> Handler(SignInCommand command) { command.Validate(); if (command.Invalid) { return(new CommandResult(false, "Ops, erro ao tentar acessar usuario.", command.Notifications)); } var user = await _userRepository.FindUserByEmail(command.Email); if (user == null) { return(new CommandResult(false, "Usuario nao existe.", null)); } if (!PasswordUtil.Verify(command.Password, user.Password)) { return(new CommandResult(false, "Usuario ou senha invalido.", null)); } var token = _tokenService.GenerateToken(user); return(new CommandResult(true, "usuario logado com sucesso.", token)); }
public bool VerifyPassword(string inputPassword) { return(PasswordUtil.Verify(inputPassword, Password)); }