Ejemplo n.º 1
0
        public async Task <IActionResult> LogInAsync(string username, string hashedPassword, string ipAddress)
        {
            var result = await _loginManager.LogInAsync(username, ipAddress, hashedPassword, Constants.InitialFailureCount);

            var authenResult = result.Data;

            if (result.ExceptionOccurred)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, result.Message));
            }

            if (authenResult.IsSuccessful)
            {
                return(Ok(new
                {
                    successful = authenResult.IsSuccessful,
                    token = authenResult.Token,
                    userType = authenResult.UserType
                }));
            }
            else
            {
                return(Ok(new { successful = authenResult.IsSuccessful, message = result.Message }));
            }
        }