mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-20 17:37:23 +08:00
fix signup/change password can not login
This commit is contained in:
@@ -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) {
|
||||
|
||||
Vendored
+2
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user