public Task HandleAsync(RegisterUserCommand command) { var salt = encypterService.GetSalt(command.Password); var passwordHash = encypterService.GetHash(command.Password, salt); var user = mapper.Map <UserEntity>(command); user.Salt = salt; user.Password = passwordHash; return(userRepository.AddAsync(user)); }
public async Task <bool> AuthenticateUserAsync(AuthenticateUserDto credentials) { var user = await userRepository.GetByUserName(credentials.UserName); return(user != null && encypterService.GetHash(credentials.Password, user.Salt) == user.Password ? true : false); }