refactor: 登录用户名不存在逻辑移动到中间件中
This commit is contained in:
parent
7149bcb61b
commit
a02a1474f5
|
@ -18,12 +18,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
/// <returns></returns>
|
||||
public IActionResult Index()
|
||||
{
|
||||
var userName = User.Identity.Name;
|
||||
if (string.IsNullOrEmpty(userName)) return Redirect(Request.PathBase + CookieAuthenticationDefaults.LoginPath);
|
||||
|
||||
var model = new HeaderBarModel(userName);
|
||||
if (string.IsNullOrEmpty(model.UserName)) return Redirect(Request.PathBase + CookieAuthenticationDefaults.LogoutPath);
|
||||
|
||||
var model = new HeaderBarModel(User.Identity.Name);
|
||||
var homeUrl = DictHelper.RetrieveHomeUrl(model.AppId);
|
||||
return homeUrl.Equals("~/Home/Index", System.StringComparison.OrdinalIgnoreCase) ? (IActionResult)View(model) : Redirect(homeUrl);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.0.1-beta3" />
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.2-beta5" />
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.2-beta6" />
|
||||
<PackageReference Include="Longbow" Version="3.0.0" />
|
||||
<PackageReference Include="Longbow.Cache" Version="3.0.1-beta1" />
|
||||
<PackageReference Include="Longbow.Data" Version="3.0.1-beta1" />
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.0.1-beta3" />
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.2-beta5" />
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.0.2-beta6" />
|
||||
<PackageReference Include="Longbow" Version="3.0.0" />
|
||||
<PackageReference Include="Longbow.Cache" Version="3.0.1-beta1" />
|
||||
<PackageReference Include="Longbow.Data" Version="3.0.1-beta1" />
|
||||
|
|
Loading…
Reference in New Issue