6.4.1用户管理
This commit is contained in:
1 parent
6d4b220933
commit
8ff4f66f9f
9 files changed
+171
-4
No files matched your search
@@ -4,6 +4,8 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using HHWMS.Web.Support;
|
||||
using HHWMS.Web.ViewModels.HomeVMs;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@@ -152,7 +154,17 @@ namespace HHWMS.Web.Controllers
|
||||
else
|
||||
return JsonMore("No Data");
|
||||
}
|
||||
[Public]
|
||||
public IActionResult CheckLogin()
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[Public]
|
||||
public IActionResult BeforeLogin(LoginVM vm)
|
||||
{
|
||||
return JsonMore(UserSessionManager.AllSignined().ToList());
|
||||
}
|
||||
//[AllowAnonymous]
|
||||
//public github GetGithubInfo()
|
||||
//{
|
||||
|
||||
@@ -14,6 +14,7 @@ using WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkUserVms;
|
||||
using HHWMS.Web.ViewModels.HomeVMs;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Support;
|
||||
|
||||
namespace HHWMS.Web.Controllers
|
||||
{
|
||||
@@ -55,6 +56,11 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
var signined = UserSessionManager.IsUserSignined(user.Name);
|
||||
if (signined)
|
||||
{
|
||||
await KickUser(user.Name);
|
||||
}
|
||||
//其他属性可以通过user.Attributes["aaa"] = "bbb"方式赋值
|
||||
Wtm.LoginUserInfo = user;
|
||||
string url = string.Empty;
|
||||
@@ -78,6 +84,7 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
var principal = user.CreatePrincipal();
|
||||
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal, properties);
|
||||
UserSessionManager.AddUserSession(user.Name, principal.Claims.First(c => c.Type == "SessionId").Value)
|
||||
return Redirect(HttpUtility.UrlDecode(url));
|
||||
}
|
||||
}
|
||||
@@ -133,6 +140,14 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[AllRights]
|
||||
public async Task<IActionResult> KickUser(string ITCode)
|
||||
{
|
||||
UserSessionManager.KickUser(ITCode);
|
||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[AllRights]
|
||||
[ActionDescription("ChangePassword")]
|
||||
public ActionResult ChangePassword()
|
||||
|
||||
Reference in new issue
Block a user