mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-19 01:58:01 +08:00
@@ -19,6 +19,7 @@ using OpenAuth.App;
|
||||
using System.Reflection;
|
||||
using System.Web.Mvc;
|
||||
using OpenAuth.Domain.Interface;
|
||||
using OpenAuth.Domain.Service;
|
||||
using OpenAuth.Repository;
|
||||
|
||||
namespace OpenAuth.Mvc
|
||||
@@ -44,6 +45,7 @@ namespace OpenAuth.Mvc
|
||||
builder.RegisterType<ResourceManagerApp>();
|
||||
builder.RegisterType<StockManagerApp>();
|
||||
builder.RegisterType<RevelanceManagerApp>();
|
||||
builder.RegisterType<AuthoriseService>();
|
||||
|
||||
// Register your MVC controllers.
|
||||
builder.RegisterControllers(typeof(MvcApplication).Assembly);
|
||||
|
@@ -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)
|
||||
|
@@ -296,6 +296,8 @@
|
||||
<Content Include="Content\jqGrid\i18n\grid.locale-ua.js" />
|
||||
<Content Include="Content\jqGrid\i18n\grid.locale-vi.js" />
|
||||
<Content Include="Content\jqGrid\jquery.jqGrid.src.js" />
|
||||
<Content Include="Content\js\purl.js" />
|
||||
<Content Include="Content\js\util.js" />
|
||||
<Content Include="Content\kindeditor_4.1.10\attached\test.txt" />
|
||||
<Content Include="Content\kindeditor_4.1.10\editor-content.css" />
|
||||
<Content Include="Content\kindeditor_4.1.10\kindeditor-all-min.js" />
|
||||
|
@@ -18,6 +18,8 @@
|
||||
<!--<add name="OpenAuthDBContext" connectionString="server=127.0.0.1;user id=root;persistsecurityinfo=True;database=openauth;password=123456" providerName="MySql.Data.MySqlClient" />-->
|
||||
</connectionStrings>
|
||||
|
||||
|
||||
|
||||
<log4net>
|
||||
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
|
||||
<!--定义文件存放位置-->
|
||||
@@ -58,10 +60,12 @@
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<authentication mode="None" />
|
||||
<authentication mode="Forms" />
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
<sessionState mode="InProc" timeout="60"/>
|
||||
<customErrors mode="On" defaultRedirect="/Login/Index">
|
||||
</customErrors>
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
<modules>
|
||||
|
Reference in New Issue
Block a user