增加LoginController验证登陆Cookie值
This commit is contained in:
parent
773270948b
commit
45b0818357
|
@ -249,6 +249,7 @@
|
|||
<Compile Include="Controllers\GroupsController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\InfosController.cs" />
|
||||
<Compile Include="Controllers\LoginController.cs" />
|
||||
<Compile Include="Controllers\LogsController.cs" />
|
||||
<Compile Include="Controllers\MenusController.cs" />
|
||||
<Compile Include="Controllers\MessagesController.cs" />
|
||||
|
|
|
@ -53,7 +53,6 @@ namespace Bootstrap.Admin.Controllers
|
|||
model.UserName = userName;
|
||||
if (LgbPrincipal.IsAdmin(userName) || UserHelper.Authenticate(userName, password))
|
||||
{
|
||||
LgbPrincipal.SavePrincipalCookie(new LgbUser() { RealUserName = userName });
|
||||
FormsAuthentication.RedirectFromLoginPage(userName, false);
|
||||
}
|
||||
return View(model);
|
||||
|
@ -66,7 +65,6 @@ namespace Bootstrap.Admin.Controllers
|
|||
public ActionResult Logout()
|
||||
{
|
||||
FormsAuthentication.SignOut();
|
||||
LgbPrincipal.UndoImpersonate();
|
||||
return RedirectToAction("Login");
|
||||
}
|
||||
/// <summary>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
using System.Web.Http;
|
||||
|
||||
namespace Bootstrap.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LoginController : ApiController
|
||||
{
|
||||
[HttpGet]
|
||||
public LoginInfo Get()
|
||||
{
|
||||
return new LoginInfo() { UserName = User.Identity.Name, Token = string.Empty };
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LoginInfo
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Token { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue