@particle-network/authkit
Version:
Auth Core provides MPC (Multi-Party Computation)-based threshold signatures.
70 lines (66 loc) • 4.03 kB
JavaScript
"use client";
import {
ParticleKeywords_default
} from "./chunk-WXBJFMBB.mjs";
import {
header_default
} from "./chunk-BOJWY33D.mjs";
import "./chunk-E62IDKOD.mjs";
import "./chunk-P6ZCFYHW.mjs";
import {
useCustomNavigate,
useParticleAuth,
useTranslation
} from "./chunk-INJ3VAC7.mjs";
import "./chunk-55PCA22M.mjs";
// src/pages/account/changePaymentPassword/index.tsx
import { useRequest } from "ahooks";
import React, { useState } from "react";
import { ApiError, verifyPaymentPassword } from "@particle-network/auth-core";
// src/pages/account/changePaymentPassword/index.less
var changePaymentPassword_default = ".payment-password-container {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n box-sizing: border-box;\n height: 100%;\n overflow: hidden;\n color: var(--text-color);\n}\n.payment-password-container > .wrapper {\n padding: 0 30px;\n}\n.payment-password-container .display-none {\n display: none;\n}\n.payment-password-container .page-title {\n margin-top: 0px;\n font-size: 22px;\n color: var(--text-color);\n text-align: center;\n}\n.payment-title {\n margin-top: 60px;\n font-size: 22px;\n color: var(--text-color);\n}\n.patment-tips1 {\n width: 80vw;\n margin-top: 30px;\n font-size: 14px;\n text-align: center;\n color: var(--text-color);\n}\n@media (min-width: 600px) {\n .patment-tips1 {\n width: calc(80 * var(--vw));\n }\n}\n.payment-buttons {\n position: absolute;\n bottom: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: center;\n width: 100%;\n height: auto;\n padding-bottom: 20px;\n}\n.success-icon {\n width: 50px;\n height: 50px;\n margin-top: 60px;\n}\n.payment-desc-1 {\n box-sizing: border-box;\n margin: 15px 0 75px;\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n text-align: center;\n color: var(--text-color);\n}\n";
// src/pages/account/changePaymentPassword/index.tsx
var ChangePaymentPassword = (prop) => {
const navigate = useCustomNavigate();
const { t } = useTranslation();
const [pwd, setPwd] = useState("");
const { setWrongPassword } = useParticleAuth();
const { loading: verifyLoading, run: runVerify } = useRequest(verifyPaymentPassword, {
manual: true,
onSuccess: (result, params) => {
navigate("/account/set-password", {
state: {
oldPassword: pwd
},
replace: true
});
},
onError: (error) => {
console.log("verify password error", error);
setPwd("");
if ((error == null ? void 0 : error.error_code) === ApiError.WrongPaymentPassword) {
setWrongPassword({ visible: true });
} else if ((error == null ? void 0 : error.error_code) === ApiError.SecurityAccountFrozen) {
const seconds = error.extra.seconds || 0;
setWrongPassword({
visible: true,
accountFrozen: {
seconds
}
});
}
}
});
const checkInputPwd = (value) => {
setPwd(value);
if (value.length === 6) {
runVerify(value);
}
};
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", null, changePaymentPassword_default), /* @__PURE__ */ React.createElement("div", { className: "payment-password-container" }, /* @__PURE__ */ React.createElement(header_default, { displayBackBtn: true }), /* @__PURE__ */ React.createElement("div", { className: "wrapper" }, /* @__PURE__ */ React.createElement("div", { className: "page-title" }, t("account.change_payment_password")), /* @__PURE__ */ React.createElement("p", { className: "payment-desc-1" }, t("account.change_enter_payment")), /* @__PURE__ */ React.createElement(ParticleKeywords_default, { onChange: checkInputPwd, value: pwd, keyboardInvisible: verifyLoading }))));
};
var changePaymentPassword_default2 = ChangePaymentPassword;
export {
changePaymentPassword_default2 as default
};
//# sourceMappingURL=changePaymentPassword-A6NQVCFL.mjs.map