From 11b125655d1be97766dc21df4dacad83208a2bb0 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 24 Jun 2024 11:05:41 +0800 Subject: [PATCH] perf: passkey help msg --- apps/authentication/backends/passkey/fido.py | 5 ++++- apps/i18n/lina/en.json | 3 ++- apps/i18n/lina/zh.json | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/authentication/backends/passkey/fido.py b/apps/authentication/backends/passkey/fido.py index 636b0bb79..4a0ebc034 100644 --- a/apps/authentication/backends/passkey/fido.py +++ b/apps/authentication/backends/passkey/fido.py @@ -109,7 +109,10 @@ def register_complete(request): data = request.data server = get_server(request) state = request.session.pop("fido2_state") - auth_data = server.register_complete(state, response=data) + try: + auth_data = server.register_complete(state, response=data) + except ValueError as e: + raise ValidationError({'error': str(e)}) encoded = websafe_encode(auth_data.credential_data) platform = get_current_platform(request) name = data.pop("key_name", '') or platform diff --git a/apps/i18n/lina/en.json b/apps/i18n/lina/en.json index cc10ea5cc..aa2c3d602 100644 --- a/apps/i18n/lina/en.json +++ b/apps/i18n/lina/en.json @@ -526,6 +526,7 @@ "HasImportErrorItemMsg": "There are import failures, click on the left x to view the failure reasons, after editing the table, you can continue to import failures.", "Help": "Help", "HighLoad": "Higher", + "HTTPSRequiredForSupport": "HTTPS is required for support", "HistoricalSessionNum": "Total historical sessions", "History": "History", "HistoryDate": "Date", @@ -1343,4 +1344,4 @@ "SuEnabled": "Enabled su", "Gateway": "Gateway", "StopLogOutput": "Task Canceled: The current task (currentTaskId) has been manually stopped. Since the progress of each task varies, the following is the final execution result of the task. A failed execution indicates that the task has been successfully stopped." -} \ No newline at end of file +} diff --git a/apps/i18n/lina/zh.json b/apps/i18n/lina/zh.json index b18af2411..cbc588b61 100644 --- a/apps/i18n/lina/zh.json +++ b/apps/i18n/lina/zh.json @@ -468,6 +468,7 @@ "ExportRange": "导出范围", "FC": "Fusion Compute", "Failed": "失败", + "HTTPSRequiredForSupport": "需要 HTTPS 支持,才能开启", "FailedAsset": "失败的资产", "FaviconTip": "提示:网站图标(建议图片大小为: 16px*16px)", "Features": "功能设置", @@ -1342,4 +1343,4 @@ "WeChat": "微信", "Gateway": "网关", "StopLogOutput": "Task Canceled:当前任务(currentTaskId)已手动停止,由于每个任务的执行进度不一样,下面是任务最终的执行结果,执行失败表示已成功停止任务执行。" -} \ No newline at end of file +}