Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
    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;
    }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
 public bool VerifyPassword(string inputPassword)
 {
     return(PasswordUtil.Verify(inputPassword, Password));
 }