diff --git a/InitModule.sql b/InitModule.sql
new file mode 100644
index 00000000..87542859
Binary files /dev/null and b/InitModule.sql differ
diff --git a/OpenAuth.App/LoginApp.cs b/OpenAuth.App/LoginApp.cs
index 9cab5e34..52d89597 100644
--- a/OpenAuth.App/LoginApp.cs
+++ b/OpenAuth.App/LoginApp.cs
@@ -1,7 +1,7 @@
-using System;
-using System.Collections.Generic;
-using OpenAuth.Domain;
using OpenAuth.Domain.Interface;
+using System;
+using Infrastructure.Helper;
+using OpenAuth.Domain;
namespace OpenAuth.App
{
@@ -16,15 +16,14 @@ namespace OpenAuth.App
public void Login(string userName, string password)
{
- var user = _repository.FindSingle(u =>u.Account ==userName);
+ var user = _repository.FindSingle(u => u.Account == userName);
if (user == null)
{
throw new Exception("ûʺŲ");
}
- // user.CheckLogin(password);
-
-
+ user.CheckPassword(password);
+ SessionHelper.AddSessionUser(user);
}
}
}
\ No newline at end of file
diff --git a/OpenAuth.Domain/Core/User.cs b/OpenAuth.Domain/Core/User.cs
new file mode 100644
index 00000000..3c14a509
--- /dev/null
+++ b/OpenAuth.Domain/Core/User.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+
+namespace OpenAuth.Domain
+{
+ ///
+ /// 用户ID
+ ///
+ public partial class User
+ {
+ public void CheckPassword(string password)
+ {
+ if (Password != password)
+ {
+ throw new Exception("密码错误");
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/OpenAuth.Domain/OpenAuth.Domain.csproj b/OpenAuth.Domain/OpenAuth.Domain.csproj
index 0983502a..e6e982e1 100644
--- a/OpenAuth.Domain/OpenAuth.Domain.csproj
+++ b/OpenAuth.Domain/OpenAuth.Domain.csproj
@@ -42,6 +42,7 @@
+
diff --git a/OpenAuth.Mvc/AutofacExt.cs b/OpenAuth.Mvc/AutofacExt.cs
index 5b1203fd..40d4991e 100644
--- a/OpenAuth.Mvc/AutofacExt.cs
+++ b/OpenAuth.Mvc/AutofacExt.cs
@@ -21,7 +21,7 @@ using System.Web.Mvc;
namespace OpenAuth.Mvc
{
- static internal class AutofacExt
+ internal static class AutofacExt
{
public static void InitAutofac()
{
diff --git a/OpenAuth.Mvc/Controllers/BaseController.cs b/OpenAuth.Mvc/Controllers/BaseController.cs
index 14baed08..2f906f26 100644
--- a/OpenAuth.Mvc/Controllers/BaseController.cs
+++ b/OpenAuth.Mvc/Controllers/BaseController.cs
@@ -29,9 +29,9 @@ namespace OpenAuth.Mvc.Controllers
base.OnActionExecuting(filterContext);
//#region 当Session过期自动跳出登录画面
- //if (SessionHelper.GetSessionUser() == null)
+ //if (SessionHelper.GetSessionUser() == null)
//{
- // Response.Redirect("~/Account/Login");
+ // Response.Redirect("/Login/Index");
//}
//#endregion
}
diff --git a/OpenAuth.Mvc/Controllers/HomeController.cs b/OpenAuth.Mvc/Controllers/HomeController.cs
index 4b8654df..48edeb93 100644
--- a/OpenAuth.Mvc/Controllers/HomeController.cs
+++ b/OpenAuth.Mvc/Controllers/HomeController.cs
@@ -26,10 +26,5 @@ namespace OpenAuth.Mvc.Controllers
{
return View();
}
-
- public ActionResult Login()
- {
- return View();
- }
}
}
\ No newline at end of file
diff --git a/OpenAuth.Mvc/Controllers/LoginController.cs b/OpenAuth.Mvc/Controllers/LoginController.cs
new file mode 100644
index 00000000..406dc91e
--- /dev/null
+++ b/OpenAuth.Mvc/Controllers/LoginController.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using OpenAuth.App;
+
+namespace OpenAuth.Mvc.Controllers
+{
+ public class LoginController : Controller
+ {
+ private LoginApp _app;
+
+ public LoginController()
+ {
+ _app = (LoginApp)DependencyResolver.Current.GetService(typeof(LoginApp));
+ }
+ // GET: Login
+ public ActionResult Index()
+ {
+ return View();
+ }
+
+ [HttpPost]
+ public ActionResult Index(string username, string password)
+ {
+ try
+ {
+ _app.Login(username, password);
+ return RedirectToAction("Index", "Home");
+
+ }
+ catch (Exception e)
+ {
+ return View(e.Message);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenAuth.Mvc/OpenAuth.Mvc.csproj b/OpenAuth.Mvc/OpenAuth.Mvc.csproj
index cd21d637..fc76ca1d 100644
--- a/OpenAuth.Mvc/OpenAuth.Mvc.csproj
+++ b/OpenAuth.Mvc/OpenAuth.Mvc.csproj
@@ -126,6 +126,7 @@
+
@@ -606,7 +607,7 @@
-
+
diff --git a/OpenAuth.Mvc/Views/Home/Index.cshtml b/OpenAuth.Mvc/Views/Home/Index.cshtml
index 7dfd34cb..ea3225a9 100644
--- a/OpenAuth.Mvc/Views/Home/Index.cshtml
+++ b/OpenAuth.Mvc/Views/Home/Index.cshtml
@@ -18,7 +18,7 @@
-
+
diff --git a/OpenAuth.Mvc/Views/Home/Login.cshtml b/OpenAuth.Mvc/Views/Login/Index.cshtml
similarity index 85%
rename from OpenAuth.Mvc/Views/Home/Login.cshtml
rename to OpenAuth.Mvc/Views/Login/Index.cshtml
index ef897040..a31fc407 100644
--- a/OpenAuth.Mvc/Views/Home/Login.cshtml
+++ b/OpenAuth.Mvc/Views/Login/Index.cshtml
@@ -1,237 +1,234 @@
-
-
-
-
- 系统登录
-
-
-
-
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
+
+
+
+
+ 系统登录
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/数据库设计关系图/PDM_OA.pdm b/数据库设计关系图/PDM_OA.pdm
index 52aa9f55..6aa233c4 100644
--- a/数据库设计关系图/PDM_OA.pdm
+++ b/数据库设计关系图/PDM_OA.pdm
@@ -1,5 +1,5 @@
-
+
@@ -12,7 +12,7 @@
PDM_OA
1430102287
yubaolee
-1448847654
+1448850188
Administrator
ORG {9C5FE510-8BFA-4205-BF00-FC94E77A24A2}
DAT 1430102318
@@ -205,7 +205,7 @@ GenScriptName6=
GenScriptName7=
GenScriptName8=
GenScriptName9=
-GenPathName=F:\测试学习\OpenAuth.Net\
+GenPathName=E:\测试学习\OpenAuth.Net\
GenSingleFile=Yes
GenODBC=Yes
GenCheckModel=No