mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-09 02:44:44 +08:00
@@ -24,6 +24,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web.Mvc;
|
||||
using OpenAuth.App;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
@@ -33,8 +34,8 @@ namespace OpenAuth.Mvc.Controllers
|
||||
|
||||
protected override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||
{
|
||||
var loginUser = SessionHelper.GetSessionUser<LoginUserVM>();
|
||||
if (loginUser == null)
|
||||
var loginUser = AutofacExt.GetFromFac<LoginApp>().GetLoginUser();
|
||||
if (!User.Identity.IsAuthenticated)
|
||||
{
|
||||
filterContext.Result = new RedirectResult("/Login/Index");
|
||||
return;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
[Anonymous]
|
||||
public ActionResult Index()
|
||||
{
|
||||
var user = SessionHelper.GetSessionUser<LoginUserVM>();
|
||||
var user = AutofacExt.GetFromFac<LoginApp>().GetLoginUser();
|
||||
return View(user.Modules);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
SessionHelper.AddSessionUser( _app.Login(username, password));
|
||||
_app.Login(username, password);
|
||||
return RedirectToAction("Index", "Home");
|
||||
|
||||
}
|
||||
@@ -51,19 +51,20 @@ namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
SessionHelper.AddSessionUser(_app.LoginByDev());
|
||||
_app.LoginByDev();
|
||||
return RedirectToAction("Index", "Home");
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return View(e.Message);
|
||||
return RedirectToAction("Index", "Login");
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult Logout()
|
||||
{
|
||||
SessionHelper.Clear();
|
||||
|
||||
FormsAuthentication.SignOut();
|
||||
return RedirectToAction("Index", "Login");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// </summary>
|
||||
public string LoadForTree()
|
||||
{
|
||||
var orgs = SessionHelper.GetSessionUser<LoginUserVM>().Modules;
|
||||
var orgs = AutofacExt.GetFromFac<LoginApp>().GetLoginUser().Modules;
|
||||
return JsonHelper.Instance.Serialize(orgs);
|
||||
}
|
||||
|
||||
public string LoadModuleWithRoot()
|
||||
{
|
||||
var orgs = SessionHelper.GetSessionUser<LoginUserVM>().Modules.MapToList<ModuleView>();
|
||||
var orgs = AutofacExt.GetFromFac<LoginApp>().GetLoginUser().Modules.MapToList<ModuleView>();
|
||||
//添加根节点
|
||||
orgs.Add(new Module
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <returns>System.String.</returns>
|
||||
public string LoadForTree()
|
||||
{
|
||||
var orgs = SessionHelper.GetSessionUser<LoginUserVM>().AccessedOrgs;
|
||||
var orgs = AutofacExt.GetFromFac<LoginApp>().GetLoginUser().AccessedOrgs;
|
||||
return JsonHelper.Instance.Serialize(orgs);
|
||||
}
|
||||
/// <summary>
|
||||
@@ -51,7 +51,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
[Anonymous]
|
||||
public string LoadOrg()
|
||||
{
|
||||
var orgs = SessionHelper.GetSessionUser<LoginUserVM>().AccessedOrgs.MapToList<Org>();
|
||||
var orgs = AutofacExt.GetFromFac<LoginApp>().GetLoginUser().AccessedOrgs.MapToList<Org>();
|
||||
//添加根节点
|
||||
orgs.Add(new Org
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
var newmodel = new Stock();
|
||||
model.CopyTo(newmodel);
|
||||
newmodel.User = SessionHelper.GetSessionUser<LoginUserVM>().User.Account;
|
||||
newmodel.User = AutofacExt.GetFromFac<LoginApp>().GetLoginUser().User.Account;
|
||||
_app.AddOrUpdate(newmodel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user