|
@@ -3,6 +3,9 @@ import hashlib
|
|
|
import json
|
|
import json
|
|
|
import os.path
|
|
import os.path
|
|
|
import re
|
|
import re
|
|
|
|
|
+import sys
|
|
|
|
|
+import tkinter
|
|
|
|
|
+from tkinter import messagebox
|
|
|
|
|
|
|
|
import requests
|
|
import requests
|
|
|
from Crypto.Cipher import AES
|
|
from Crypto.Cipher import AES
|
|
@@ -35,10 +38,22 @@ class ServerClient:
|
|
|
}, headers={'Content-Type': 'multipart/form-data',
|
|
}, headers={'Content-Type': 'multipart/form-data',
|
|
|
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36'})
|
|
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36'})
|
|
|
|
|
|
|
|
|
|
+ reply_data = reply.json()
|
|
|
|
|
+ if 'access_token' not in reply_data:
|
|
|
|
|
+ self.show_error_window(reply_data['msg'])
|
|
|
|
|
+
|
|
|
self.access_token = reply.json()['access_token']
|
|
self.access_token = reply.json()['access_token']
|
|
|
self.login_reply = reply.json()
|
|
self.login_reply = reply.json()
|
|
|
self.headers['Authorization'] = f'Bearer {self.access_token}'
|
|
self.headers['Authorization'] = f'Bearer {self.access_token}'
|
|
|
|
|
|
|
|
|
|
+ def show_error_window(self, message):
|
|
|
|
|
+ root = tkinter.Tk()
|
|
|
|
|
+ root.withdraw()
|
|
|
|
|
+ root.attributes('-topmost', True)
|
|
|
|
|
+ messagebox.showerror("登录失败", message)
|
|
|
|
|
+ root.destroy()
|
|
|
|
|
+ sys.exit(0)
|
|
|
|
|
+
|
|
|
def decryption(self, hex_str, secret='anZz000000000000'):
|
|
def decryption(self, hex_str, secret='anZz000000000000'):
|
|
|
key_bytes = secret.encode('utf-8')
|
|
key_bytes = secret.encode('utf-8')
|
|
|
iv = key_bytes
|
|
iv = key_bytes
|