TG.WXCRM.V4/WEB/Controllers/Base/ErrorController.cs

64 lines
1.8 KiB
C#

using System;
using System.Web.Mvc;
using WX.CRM.BLL.Util;
using WX.CRM.Common;
using WX.CRM.WebHelper;
namespace WX.CRM.WEB.Controllers.Base
{
public class ErrorController : Controller
{
//
// GET: /Error/
public ActionResult ErrorView(string message)
{
return View((object)message);
}
public ActionResult NoRightView()
{
return View();
}
[HttpGet]
public ActionResult AuthorizeSession()
{
var returnUrl = Request["returnUrl"];
if (string.IsNullOrEmpty(returnUrl))
{
return View();
}
ViewBag.returnUrl = returnUrl;
return View();
}
[HttpPost]
public JsonResult AuthorizeSession(string pwd)
{
try
{
if (string.IsNullOrEmpty(pwd))
{
return JsonHandler.ManageMessage("参数错误", false);
}
WX.CRM.IBLL.Util.ISecurityHelper sHelper = new SecurityHelper();
string clientid = Utility.GetSettingByKey("CRMClientKey");
var sessonPwd = new CACHE_BL().GetValue_Parameter("SessionPwd");
var pwd2 = sHelper.decyptData(clientid, sessonPwd);
if (pwd != pwd2)
{
return Json(new { msg = "no" }, JsonRequestBehavior.AllowGet);
}
Session["AuthorizeSession"] = pwd;
//Session.Timeout = 1;
return Json(new { msg = "ok" }, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
return JsonHandler.ManageMessage(ex.Message, false);
}
}
}
}