public async Task <IActionResult> Login([FromBody] LoginCredentialsQuery value)
        {
            var res = await Mediator.Send(value);

            if (res != null)
            {
                var tokenData = await GetToken(res);

                return(Ok(tokenData));
            }

            return(NotFound("Invalid User-name or password"));
        }
Exemplo n.º 2
0
        private ActionResult CheckMustChangePassword(ControllerContext filterContext, Guid userId)
        {
            // Only check on a home page.  Normally when a user logs in they are redirected.
            // This is here in case they log in through the API and then access a page.
            // Should really check on every page but don't want to access the database every time.

            if (!filterContext.HttpContext.IsHomeUrl())
            {
                return(null);
            }

            var credentials = LoginCredentialsQuery.GetCredentials(userId);

            if (credentials != null && credentials.MustChangePassword)
            {
                return(new RedirectToRouteResult(AccountsRoutes.MustChangePassword.Name, new RouteValueDictionary()));
            }
            return(null);
        }