コード例 #1
0
ファイル: UsersController.cs プロジェクト: Gene-Huh/Team-Mike
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public User GetUser(int userID)
 {
     return(usersDAO.GetUser(userID));
 }