public bool CheckPlatformIsAuthorize() { PlatformAuthorizeHelper helper = new PlatformAuthorizeHelper(); bool isAuthorize = helper.CheckPlatformIsAuthorize();//如果授权码可用 return(isAuthorize); }
public ActionResult Auth(AuthorizeVM model) { var isAuthorizeSuccess = false; DateTime?Deadline = null; var bll = base.CreateBusiness <IAuthBusiness>(); if (ModelState.IsValid) { isAuthorizeSuccess = bll.AuthorizePlat(model);//调用业务层 验证授权码 AuthorizeResultVM authResult = new AuthorizeResultVM(); authResult.isAuthorizeSuccess = isAuthorizeSuccess; if (isAuthorizeSuccess) { PlatformAuthorizeHelper helper = new PlatformAuthorizeHelper(); Deadline = helper.GetAuthorizedDeadline(model.AuthorizeCode); authResult.AuthorizeDeadline = Deadline; return(View("AuthorizeResult", authResult)); } else { return(View("AuthorizeResult", authResult)); } } else { //todo:等父类 加了warning 提示,把error 换成warning return(base.Error("未通过验证")); } }
// GET: Authorize 授权页面 public ActionResult Register() { PlatformAuthorizeHelper helper = new PlatformAuthorizeHelper(); AuthorizeVM model = new AuthorizeVM(); model.MachineCode = helper.GetMachineCode(); #if DEBUG model.AuthorizeCode = helper.GetAuthorizeCode(model.MachineCode, new TimeSpan(354, 0, 0, 0, 0)); #endif return(View(model)); }
/// <summary> /// 传入平台识别码,和授权码,并核对平台识别码是否合法,并且授权码是否可用,则写入授权码到服务器根目录文件。 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AuthorizePlat(AuthorizeVM model) { var isAuthorize = false; PlatformAuthorizeHelper helper = new PlatformAuthorizeHelper(); var MachineCode = helper.GetMachineCode(); if (MachineCode == model.MachineCode) { isAuthorize = helper.CheckPlatformIsAuthorize(model.AuthorizeCode);//如果授权码可用 if (isAuthorize) { helper.WriteAuthorizeToConfig(model.AuthorizeCode); } } return(isAuthorize); }