增加功能:升级Longbow.Web组件登录界面增加移动设备请求判断

This commit is contained in:
Argo-MacBookPro 2018-06-10 18:14:28 +08:00
parent 42f1a38994
commit 7deaf9a46f
2 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,7 @@
<ItemGroup>
<PackageReference Include="Bootstrap.Security.Mvc" Version="1.0.0" />
<PackageReference Include="Longbow.Web" Version="1.0.0" />
<PackageReference Include="Longbow.Web" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.8" />
</ItemGroup>

View File

@ -1,6 +1,7 @@
using Bootstrap.Admin.Models;
using Bootstrap.DataAccess;
using Bootstrap.Security;
using Longbow.Web;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
@ -32,9 +33,9 @@ namespace Bootstrap.Admin.Controllers
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(identity), new AuthenticationProperties() { IsPersistent = remember == "true" });
return Redirect("~/");
}
var mobile = true; //Request.Browser.IsMobileDevice;
var model = "IPad"; //Request.Browser.MobileDeviceModel;
return mobile && model != "IPad" ? View("Loginm", new ModelBase()) : View("Login", new ModelBase());
var mobile = Request.IsMobileDevice();
var model = Request.IPad();
return mobile && !model ? View("Loginm", new ModelBase()) : View("Login", new ModelBase());
}
/// <summary>
/// Logout this instance.