public UserEdit GetUser(string username) { User requestedUser = dao.GetUser(username); UserEdit foundUser = new UserEdit(); foundUser.FirstName = requestedUser.FirstName; foundUser.LastName = requestedUser.LastName; foundUser.Role = requestedUser.Role; foundUser.Username = requestedUser.Username; return(foundUser); }
public IActionResult Login(AuthenticateUser model) { IActionResult result = Unauthorized(); var user = userDAO.GetUser(model.Username); if (user.Username != null && passwordHasher.VerifyPasswordMatch(user.Password, model.Password, user.Salt)) { var token = tokenGenerator.GenerateToken(user.Username, user.Role); result = Ok(token); } return(result); }
public User GetUser(int userID) { return(usersDAO.GetUser(userID)); }