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()))