修改BUG:登录页面脚本根据ReturnUrl进行跳转

This commit is contained in:
Argo-MacBookPro 2018-09-12 15:07:46 +08:00
parent 854ec1d4eb
commit c2b6291fa0
1 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,10 @@ namespace Bootstrap.Admin.Controllers
var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme);
identity.AddClaim(new Claim(ClaimTypes.Name, userName));
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(identity), new AuthenticationProperties() { IsPersistent = remember == "true" });
return Redirect("~/");
// redirect origin url
var originUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter];
return Redirect(originUrl.Count == 1 ? originUrl[0] : "~/");
}
return View("Login", new ModelBase());
}