From c3aa540571c9be0e8950d15a6df8d3f0cd9f0947 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Thu, 22 May 2025 01:52:52 +0700 Subject: [PATCH] fix signup/change password can not login --- include/globalfunctions.php | 6 +++--- public/js/common.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/globalfunctions.php b/include/globalfunctions.php index d3f89229..0bf24449 100644 --- a/include/globalfunctions.php +++ b/include/globalfunctions.php @@ -1566,11 +1566,11 @@ async function login(username, password, jqForm) { return } - const clientHashedPassword = await sha256(password); + const clientHashedPassword = sha256(password); - const serverSideHash = await sha256(challengeData.data.secret + clientHashedPassword); + const serverSideHash = sha256(challengeData.data.secret + clientHashedPassword); - const clientResponse = await hmacSha256(challengeData.data.challenge, serverSideHash); + const clientResponse = hmacSha256(challengeData.data.challenge, serverSideHash); jqForm.find("input[name=response]").val(clientResponse) jqForm.submit() } catch (error) { diff --git a/public/js/common.js b/public/js/common.js index 99f8b114..aedab636 100644 --- a/public/js/common.js +++ b/public/js/common.js @@ -407,7 +407,7 @@ function DelRow(anchor){ // 工具函数:SHA-256哈希 // 因 crypto.subtle 在 http 下不可用,故引入三方库 -async function sha256(message) { +function sha256(message) { // const msgBuffer = new TextEncoder().encode(message); // const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer); // const hashArray = Array.from(new Uint8Array(hashBuffer)); @@ -416,7 +416,7 @@ async function sha256(message) { } // 工具函数:HMAC-SHA256 -async function hmacSha256(key, message) { +function hmacSha256(key, message) { // const encoder = new TextEncoder(); // const keyData = encoder.encode(key); // const messageData = encoder.encode(message);