Exemple #1
0
        public ActionResult <AuthenticateResponse> Login(UserLogin model)
        {
            Boolean status = AuthenticateUsers.AuthenticateUser(model);

            if (status != false)
            {
                var response = new MapUserProfile(_mapper).UserProfileMapped(model);
                if (response != null)
                {
                    var token = _jwtGenerator.generateJwtToken(response, model.Username);
                    return(new AuthenticateResponse(response, token));
                }
                return(Unauthorized(new { message = "This user doesn't register in the system yet" }));
            }
            return(Unauthorized(new { message = "Username or password is incorrect" }));
        }