public IActionResult Authenticate([FromBody] User user)
        {
            var foundUser = _userActions.Authenticate(user.UserName, user.Password);

            if (foundUser.User == null)
            {
                return(BadRequest("Username or password is incorrect."));
            }
            foundUser.User.Role = user.Role;
            return(Ok(new { foundUser.User.Token, foundUser.User.UserName }));
        }
예제 #2
0
        public async Task <ApiResponse> Authenticate([FromBody] Login userParam)
        {
            var response = await _userAction.Authenticate(userParam.UserName, userParam.Password);

            return(response);
        }