mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-09 10:54:46 +08:00
删除AceAdmin界面,使用基于bootstrap的B-JUI前端构架
This commit is contained in:
@@ -1,85 +0,0 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure.Helper;
|
||||
using Newtonsoft.Json;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.Domain.Interface;
|
||||
using OpenAuth.Mvc.Models;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class AccountController : Controller
|
||||
{
|
||||
private LoginApp _loginApp;
|
||||
|
||||
public AccountController()
|
||||
{
|
||||
_loginApp = (LoginApp) DependencyResolver.Current.GetService(typeof (LoginApp));
|
||||
}
|
||||
//
|
||||
// GET: /Account/Login
|
||||
[AllowAnonymous]
|
||||
public ActionResult Login(string returnUrl)
|
||||
{
|
||||
ViewBag.ReturnUrl = returnUrl;
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/Login
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
//直接生成登陆用户,在实际的项目中采用数据库形式
|
||||
try
|
||||
{
|
||||
_loginApp.Login(model.UserName, model.Password);
|
||||
SessionHelper.AddSessionUser(model);
|
||||
return RedirectToLocal(returnUrl);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
ModelState.AddModelError("", exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果我们进行到这一步时某个地方出错,则重新显示表单
|
||||
return View(model);
|
||||
}
|
||||
|
||||
//
|
||||
// POST: /Account/LogOff
|
||||
public ActionResult LogOff()
|
||||
{
|
||||
SessionHelper.Clear();
|
||||
return RedirectToAction("Login", "Account");
|
||||
}
|
||||
|
||||
public ActionResult List()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private ActionResult RedirectToLocal(string returnUrl)
|
||||
{
|
||||
if (Url.IsLocalUrl(returnUrl))
|
||||
{
|
||||
return Redirect(returnUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
return RedirectToAction("Index", "Home");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,12 +25,12 @@ namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
base.OnActionExecuting(filterContext);
|
||||
|
||||
#region 当Session过期自动跳出登录画面
|
||||
if (SessionHelper.GetSessionUser<LoginViewModel>() == null)
|
||||
{
|
||||
Response.Redirect("~/Account/Login");
|
||||
}
|
||||
#endregion
|
||||
//#region 当Session过期自动跳出登录画面
|
||||
//if (SessionHelper.GetSessionUser<LoginViewModel>() == null)
|
||||
//{
|
||||
// Response.Redirect("~/Account/Login");
|
||||
//}
|
||||
//#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,16 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
public ContentResult Main()
|
||||
{
|
||||
return Content("欢迎使用基于DDD的权限管理系统");
|
||||
}
|
||||
|
||||
public ActionResult Login()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public string LoadUsers()
|
||||
{
|
||||
return JsonConvert.SerializeObject(_loginApp.LoadUsers());
|
||||
|
||||
Reference in New Issue
Block a user