diff --git a/OpenAuth.Mvc/Controllers/LoginController.cs b/OpenAuth.Mvc/Controllers/LoginController.cs index de1db712..467c542e 100644 --- a/OpenAuth.Mvc/Controllers/LoginController.cs +++ b/OpenAuth.Mvc/Controllers/LoginController.cs @@ -1,4 +1,5 @@ using System; +using System.Configuration; using System.Web.Mvc; using OpenAuth.App.SSO; using OpenAuth.Mvc.Models; @@ -7,11 +8,12 @@ namespace OpenAuth.Mvc.Controllers { public class LoginController : Controller { - private const string AppKey = "openauth"; + private string _appKey = ConfigurationManager.AppSettings["SSOAppKey"]; // GET: Login public ActionResult Index() { + ViewBag.AppKey = _appKey; return View(); } @@ -20,7 +22,7 @@ namespace OpenAuth.Mvc.Controllers { try { - var result = AuthUtil.Login(AppKey, username, password); + var result = AuthUtil.Login(_appKey, username, password); if (result.Success) return Redirect("/home/index?Token=" + result.Token); else @@ -52,7 +54,7 @@ namespace OpenAuth.Mvc.Controllers { try { - var result = AuthUtil.Login(AppKey, "System","123456"); + var result = AuthUtil.Login(_appKey, "System","123456"); if (result.Success) return Redirect("/home/index?Token=" + result.Token); else diff --git a/OpenAuth.Mvc/Views/Login/Index.cshtml b/OpenAuth.Mvc/Views/Login/Index.cshtml index fc60d693..931c4c11 100644 --- a/OpenAuth.Mvc/Views/Login/Index.cshtml +++ b/OpenAuth.Mvc/Views/Login/Index.cshtml @@ -238,7 +238,7 @@
可以用admin(密码:admin) /test(密码:test) 查看不同账号登陆情况
Copyright © 2015 基于经典DDD的权限管理 - 点击以开发者账号登录
- 或者使用OpenAuth.net第三方登陆功能 + 或者使用OpenAuth.net第三方登陆功能
diff --git a/OpenAuth.WebTest/Controllers/LoginController.cs b/OpenAuth.WebTest/Controllers/LoginController.cs index 61c738ff..7e0f2257 100644 --- a/OpenAuth.WebTest/Controllers/LoginController.cs +++ b/OpenAuth.WebTest/Controllers/LoginController.cs @@ -1,20 +1,23 @@ -using System.Web.Mvc; +using System.Configuration; +using System.Web.Mvc; using OpenAuth.App.SSO; namespace OpenAuth.WebTest.Controllers { public class LoginController : Controller { + private string _appKey = ConfigurationManager.AppSettings["SSOAppKey"]; // GET: Login public ActionResult Index() { + ViewBag.AppKey = _appKey; return View(); } [HttpPost] public ActionResult Index(string username, string password) { - var result = AuthUtil.Login("openauth", username, password); + var result = AuthUtil.Login(_appKey, username, password); if (result.Success) return Redirect("/home/index?Token=" + result.Token); else diff --git a/OpenAuth.WebTest/Views/Login/Index.cshtml b/OpenAuth.WebTest/Views/Login/Index.cshtml index 14510d0b..5873a1b2 100644 --- a/OpenAuth.WebTest/Views/Login/Index.cshtml +++ b/OpenAuth.WebTest/Views/Login/Index.cshtml @@ -35,7 +35,7 @@ Remember me - 或者使用OpenAuth.net第三方登陆功能 + 或者使用OpenAuth.net第三方登陆功能