fix: CryptoES -> CryptoJS

This commit is contained in:
CrescentLeaf
2025-09-08 21:26:09 +08:00
parent e2c385b559
commit 45aef8204a
2 changed files with 4 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ import useEventListener from "../useEventListener.ts"
import { checkApiSuccessOrSncakbar } from "../snackbar.ts" import { checkApiSuccessOrSncakbar } from "../snackbar.ts"
import Client from "../../api/Client.ts" import Client from "../../api/Client.ts"
import * as CryptoES from 'crypto-es' import * as CryptoJS from 'crypto-js'
import data from "../../Data.ts"; import data from "../../Data.ts";
interface Refs { interface Refs {
@@ -29,7 +29,7 @@ export default function LoginDialog({
const re = await Client.invoke("User.login", { const re = await Client.invoke("User.login", {
account: account, account: account,
password: CryptoES.SHA256(password).toString(CryptoES.Hex), password: CryptoJS.SHA256(password).toString(CryptoJS.enc.Hex),
}) })
if (checkApiSuccessOrSncakbar(re, "登錄失敗")) return if (checkApiSuccessOrSncakbar(re, "登錄失敗")) return

View File

@@ -4,7 +4,7 @@ import useEventListener from "../useEventListener.ts";
import Client from "../../api/Client.ts"; import Client from "../../api/Client.ts";
import { checkApiSuccessOrSncakbar, snackbar } from "../snackbar.ts"; import { checkApiSuccessOrSncakbar, snackbar } from "../snackbar.ts";
import * as CryptoES from 'crypto-es' import * as CryptoES from 'crypto-js'
interface Refs { interface Refs {
loginInputAccountRef: React.MutableRefObject<TextField | null> loginInputAccountRef: React.MutableRefObject<TextField | null>
@@ -31,7 +31,7 @@ export default function RegisterDialog({
const re = await Client.invoke("User.register", { const re = await Client.invoke("User.register", {
username: username, username: username,
nickname: registerInputNickNameRef.current!.value, nickname: registerInputNickNameRef.current!.value,
password: CryptoES.SHA256(registerInputPasswordRef.current!.value).toString(CryptoES.Hex), password: CryptoJS.SHA256(registerInputPasswordRef.current!.value).toString(CryptoJS.enc.Hex),
}) })
if (checkApiSuccessOrSncakbar(re, "注冊失敗")) return if (checkApiSuccessOrSncakbar(re, "注冊失敗")) return