public async Task <Login> Authenticate(string userId, string password) { var hashedPassword = _hashGenerator.ComputeSha1Hash(password); var user = await _authRepository.GetUser(userId, hashedPassword); if (user == null) { return(null); } return(new Login { Token = await _tokenService.CreateToken(userId), User = user }); }
public async Task <EntityState> Create(User user) { user.Password = _hashGenerator.ComputeSha1Hash(user.Password); return(await _usersRepository.Create(user)); }