Exemplo n.º 1
0
        public async Task <ActionResult> Login(SigninViewModel model)
        {
            //var result = AccessAPI<SigninViewModel, SigninViewModel>.AuthenticateUser(model,"AuthorizeUser").Result;
            //if (result != null)
            //{
            var apiToken = AccessAPI <SigninViewModel, UserToken> .GetApiToken(model, "token", HttpContentTypes.ConvertToEncodedUrl);

            await Task.WhenAll(apiToken);

            await AuthenticateUser(model, apiToken.Result);

            return(new RedirectToRouteResult(new RouteValueDictionary(new { controller = "User", action = "Dashboard" })));

            //}
            ViewBag.LoginError = "Invalid username or password";
            return(View(model));
        }