From ebef42cc550eae92605206c922549b7c175db77b Mon Sep 17 00:00:00 2001 From: suti7yk5032 Date: Sat, 7 Sep 2024 14:06:26 +0900 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E9=83=A8=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E3=81=A8=E3=81=8D=E3=82=82=E3=83=91=E3=82=B9=E3=83=AF?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=81=8C=E9=96=93=E9=81=95=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=82=8B=E3=81=A8=E5=87=BA=E5=8A=9B=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dislocker_auth.py | 12 ++++++++---- dislocker_client.py | 9 ++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/dislocker_auth.py b/dislocker_auth.py index 742a398..bfcaa43 100644 --- a/dislocker_auth.py +++ b/dislocker_auth.py @@ -94,7 +94,7 @@ class Auth(): return {"result": 0, "about": "ok", "output_dict": {"keyboard_number": keyboard_number, "mouse_number": mouse_number}} else: - return {"result": 1, "about": "unregistered_pc"} + return {"result": 1, "about": "incorrect_password"} else: cursor.execute("SELECT * FROM pc_list WHERE pc_number = %s AND pc_uuid = %s AND pc_token = %s", (pc_number, pc_uuid, pc_token)) pc_info = cursor.fetchall() @@ -361,9 +361,13 @@ def verify(): auth.device_use_register(pc_number=pc_number, keyboard_number=pc_auth["output_dict"]["keyboard_number"], mouse_number=pc_auth["output_dict"]["mouse_number"]) print(str(pc_number) + "の認証処理は成功しました.") return jsonify({'message': 'ok'}), 200 - else: - print(str(pc_number) + "の認証処理は失敗しました.") - return jsonify({'message': 'damedesu'}), 401 + elif pc_auth["result"] == 1: + if pc_auth["about"] == "incorrect_password": + print(str(pc_number) + "の認証処理はパスワードが正しくないため失敗しました.") + return jsonify({'message': 'incorrect_password'}), 401 + else: + print(str(pc_number) + "の認証処理は失敗しました.") + return jsonify({'message': 'damedesu'}), 500 @app.route('/stop', methods=['POST']) def stop(): diff --git a/dislocker_client.py b/dislocker_client.py index 11bf302..7effd52 100644 --- a/dislocker_client.py +++ b/dislocker_client.py @@ -378,13 +378,20 @@ class Lock(customtkinter.CTkToplevel): if responce.status_code == 200: print("認証サーバー経由で認証しました。") self.exit() - else: + elif responce.status_code == 401: print("認証サーバー経由での認証に失敗しました。") self.withdraw() msgbox = tkinter.messagebox.showinfo(title=f"{app_name} | 誤ったパスワード", message=f"パスワードが間違っています!") self.msg_subtitle_1.configure(text='パスワードが間違っています! ') self.button_enable() self.deiconify() + elif responce.status_code == 500: + print("内部エラーにより認証に失敗しました。") + self.withdraw() + msgbox = tkinter.messagebox.showinfo(title=f"{app_name} | 内部エラー", message=f"内部エラーにより認証に失敗しました。") + self.msg_subtitle_1.configure(text='内部エラーにより認証に失敗しました。 ') + self.button_enable() + self.deiconify() except: print("認証サーバーにアクセスできません。マスターパスワードで認証を試行します。") master_password_hash = self.hash_genarate(str(self.password_entry.get()))