|
@@ -50,33 +50,56 @@ namespace PDF_Master.Helper
|
|
|
|
|
|
|
|
|
|
|
|
- //验证邮箱
|
|
|
+ /// <summary>
|
|
|
+ /// 验证邮箱
|
|
|
+ /// </summary>
|
|
|
public static string OKemailUrl = "/pdf-office-sso/auth/validUser";
|
|
|
|
|
|
- //验证验证码
|
|
|
+ /// <summary>
|
|
|
+ /// 验证验证码
|
|
|
+ /// </summary>
|
|
|
public static string OKcodeUrl = "/pdf-office-sso/auth/isEmailCodeValid";
|
|
|
|
|
|
- //发送验证码
|
|
|
+ /// <summary>
|
|
|
+ /// 发送验证码
|
|
|
+ /// </summary>
|
|
|
public static string GetcodeUrl = "/pdf-office-sso/auth/getVerifyCode";
|
|
|
|
|
|
- //注册邮箱
|
|
|
+ /// <summary>
|
|
|
+ /// 注册邮箱
|
|
|
+ /// </summary>
|
|
|
public static string registerUrl = "/pdf-office-sso/auth/emailRegister";
|
|
|
|
|
|
- //登录
|
|
|
+ /// <summary>
|
|
|
+ /// /登录
|
|
|
+ /// </summary>
|
|
|
public static string LoginUrl = "/pdf-office-sso/auth/emailLogin";
|
|
|
|
|
|
- //登出
|
|
|
+ /// <summary>
|
|
|
+ /// 登出
|
|
|
+ /// </summary>
|
|
|
public static string LogoutUrl = "/pdf-office-sso/user/logout";
|
|
|
|
|
|
- //注销
|
|
|
+ /// <summary>
|
|
|
+ /// 注销
|
|
|
+ /// </summary>
|
|
|
public static string UseroutUrl = "/pdf-office-sso/user/logOffForUser";
|
|
|
|
|
|
- //重置密码
|
|
|
+ /// <summary>
|
|
|
+ /// 重置密码
|
|
|
+ /// </summary>
|
|
|
public static string RebirthUrl = "/pdf-office-sso/auth/resetPassword";
|
|
|
|
|
|
- //获取用户信息
|
|
|
+ /// <summary>
|
|
|
+ /// 获取用户信息
|
|
|
+ /// </summary>
|
|
|
public static string GetUserUrl = "/pdf-office-sso/user/me";
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 设备是否被自动登出
|
|
|
+ /// </summary>
|
|
|
+ public static string CheckDeviceStatusUrl = "/pdf-office-sso/auth/checkDeviceStatus";
|
|
|
+
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
@@ -262,7 +285,7 @@ namespace PDF_Master.Helper
|
|
|
//判断本地有没有token,没有显示登录,有再判断登录状态
|
|
|
if (Settings.Default.AppProperties.LoginToken != "")
|
|
|
{
|
|
|
- if (ServiceHelper.GetUser() == "401")
|
|
|
+ if (ServiceHelper.GetUser() == "330"|| ServiceHelper.GetUser() == "304")
|
|
|
{
|
|
|
App.mainWindowViewModel.UserVis = Visibility.Collapsed;
|
|
|
App.mainWindowViewModel.LoginVis = Visibility.Visible;
|
|
@@ -430,8 +453,17 @@ namespace PDF_Master.Helper
|
|
|
return "No Token";
|
|
|
else if(statusCode == 401)
|
|
|
{
|
|
|
- App.IsLogin = false;
|
|
|
- return "401";
|
|
|
+ if(CheckDeviceStatusout()=="330")
|
|
|
+ {
|
|
|
+ App.IsLogin = false;
|
|
|
+ return "330";
|
|
|
+ }
|
|
|
+
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return "304";
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else return "300";
|
|
|
}
|
|
@@ -760,7 +792,6 @@ namespace PDF_Master.Helper
|
|
|
}
|
|
|
if (jobject["code"].ToObject<string>().ToLower() == "200")
|
|
|
{
|
|
|
-
|
|
|
for (int i = 0; i < App.Current.Windows.Count; i++)
|
|
|
{
|
|
|
MainWindow win = App.Current.Windows[i] as MainWindow;
|
|
@@ -1004,7 +1035,50 @@ namespace PDF_Master.Helper
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 设备是否被自动登出
|
|
|
+ /// </summary>
|
|
|
+ public static String CheckDeviceStatusout()
|
|
|
+ {
|
|
|
+
|
|
|
+ string postBody = $"?appId=16&deviceSign={GetDeviceSerialNumber()}";
|
|
|
+ HttpWebResponse response = null;
|
|
|
+ ServicePointManager.DefaultConnectionLimit = 200;
|
|
|
+ HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + CheckDeviceStatusUrl + postBody);
|
|
|
+ request.Method = "Post";
|
|
|
+ request.ContentType = "application/x-www-form-urlencoded";
|
|
|
+ //request.Accept = "application/vnd.api+json;version=1";
|
|
|
+ request.UserAgent = "Apifox/1.0.0 (https://www.apifox.cn)";
|
|
|
+ request.Timeout = 20000;
|
|
|
+ request.ServicePoint.Expect100Continue = false;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ response = (HttpWebResponse)request.GetResponse();
|
|
|
+ using (StreamReader reader = new StreamReader(response.GetResponseStream()))
|
|
|
+ {
|
|
|
+ string responseData = reader.ReadToEnd();
|
|
|
+ Console.WriteLine(responseData);
|
|
|
+ reader.Close();
|
|
|
+ JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData);
|
|
|
+ if (response != null)
|
|
|
+ {
|
|
|
+ response.Close();
|
|
|
+ }
|
|
|
+ if (request != null)
|
|
|
+ {
|
|
|
+ request.Abort();
|
|
|
+ }
|
|
|
+ return jobject["code"].ToObject<string>().ToLower();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ return "300";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|