mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 23:13:40 +08:00
routine update
This commit is contained in:
parent
0aa470a8ca
commit
aabd344ec9
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Configuration;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using OpenAuth.App.SSO;
|
using OpenAuth.App.SSO;
|
||||||
using OpenAuth.Mvc.Models;
|
using OpenAuth.Mvc.Models;
|
||||||
@ -7,11 +8,12 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
{
|
{
|
||||||
public class LoginController : Controller
|
public class LoginController : Controller
|
||||||
{
|
{
|
||||||
private const string AppKey = "openauth";
|
private string _appKey = ConfigurationManager.AppSettings["SSOAppKey"];
|
||||||
|
|
||||||
// GET: Login
|
// GET: Login
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
|
ViewBag.AppKey = _appKey;
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,7 +22,7 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = AuthUtil.Login(AppKey, username, password);
|
var result = AuthUtil.Login(_appKey, username, password);
|
||||||
if (result.Success)
|
if (result.Success)
|
||||||
return Redirect("/home/index?Token=" + result.Token);
|
return Redirect("/home/index?Token=" + result.Token);
|
||||||
else
|
else
|
||||||
@ -52,7 +54,7 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = AuthUtil.Login(AppKey, "System","123456");
|
var result = AuthUtil.Login(_appKey, "System","123456");
|
||||||
if (result.Success)
|
if (result.Success)
|
||||||
return Redirect("/home/index?Token=" + result.Token);
|
return Redirect("/home/index?Token=" + result.Token);
|
||||||
else
|
else
|
||||||
|
@ -238,7 +238,7 @@
|
|||||||
<div class="bottom">
|
<div class="bottom">
|
||||||
可以用admin(密码:admin) /test(密码:test) 查看不同账号登陆情况<br>
|
可以用admin(密码:admin) /test(密码:test) 查看不同账号登陆情况<br>
|
||||||
Copyright © 2015 <a href="/Login/LoginByDev">基于经典DDD的权限管理 - 点击以开发者账号登录</a><br/>
|
Copyright © 2015 <a href="/Login/LoginByDev">基于经典DDD的权限管理 - 点击以开发者账号登录</a><br/>
|
||||||
<a href="http://localhost:52789/SSO/Login?appkey=openauth">或者使用OpenAuth.net第三方登陆功能</a>
|
<a href="http://localhost:52789/SSO/Login?appkey=@ViewBag.AppKey">或者使用OpenAuth.net第三方登陆功能</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,20 +1,23 @@
|
|||||||
using System.Web.Mvc;
|
using System.Configuration;
|
||||||
|
using System.Web.Mvc;
|
||||||
using OpenAuth.App.SSO;
|
using OpenAuth.App.SSO;
|
||||||
|
|
||||||
namespace OpenAuth.WebTest.Controllers
|
namespace OpenAuth.WebTest.Controllers
|
||||||
{
|
{
|
||||||
public class LoginController : Controller
|
public class LoginController : Controller
|
||||||
{
|
{
|
||||||
|
private string _appKey = ConfigurationManager.AppSettings["SSOAppKey"];
|
||||||
// GET: Login
|
// GET: Login
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
|
ViewBag.AppKey = _appKey;
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Index(string username, string password)
|
public ActionResult Index(string username, string password)
|
||||||
{
|
{
|
||||||
var result = AuthUtil.Login("openauth", username, password);
|
var result = AuthUtil.Login(_appKey, username, password);
|
||||||
if (result.Success)
|
if (result.Success)
|
||||||
return Redirect("/home/index?Token=" + result.Token);
|
return Redirect("/home/index?Token=" + result.Token);
|
||||||
else
|
else
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<input type="checkbox"> Remember me
|
<input type="checkbox"> Remember me
|
||||||
</label>
|
</label>
|
||||||
<button type="submit" class="btn btn-primary">登陆</button>
|
<button type="submit" class="btn btn-primary">登陆</button>
|
||||||
<a href="http://localhost:52789/SSO/Login?appkey=openauthtest">或者使用OpenAuth.net第三方登陆功能</a>
|
<a href="http://localhost:52789/SSO/Login?appkey=@ViewBag.AppKey">或者使用OpenAuth.net第三方登陆功能</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user