账户登录时添加服务器端BS系统的版本验证。

This commit is contained in:
dathlin
2017-07-22 22:22:25 +08:00
parent 296455f6d6
commit d4ff9e4cd5

View File

@@ -1,6 +1,7 @@
using ClientsLibrary;
using CommonLibrary;
using HslCommunication;
using HslCommunication.BasicFramework;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -75,6 +76,34 @@ namespace 软件系统浏览器模版.Controllers
return Login(result.Message);
}
result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.);
if (result.IsSuccess)
{
//服务器应该返回服务器的版本号
SystemVersion sv = new SystemVersion(result.Content);
//系统账户跳过低版本检测
if (fc["UserName"] != "admin")
{
if (UserClient.CurrentVersion != sv)
{
return Login("当前版本号不正确,需要服务器更新才允许登录。");
}
}
else
{
if (UserClient.CurrentVersion < sv)
{
return Login("版本号过时,需要管理员更新才允许登录。");
}
}
}
else
{
//访问失败
return Login(result.Message);
}
//允许登录并记录到Session
return RedirectToAction("Index", "Home");
}