UNPKG

@coko/client

Version:

Client side common code for coko apps

79 lines (78 loc) 2.69 kB
import e from "../common/Spin.js"; import t from "../common/Result.js"; import n from "../common/Form.js"; import r from "../common/Input.js"; import i from "../common/Page.js"; import { Paragraph as a } from "../common/Typography.js"; import "../common/index.js"; import o from "./AuthenticationForm.js"; import s from "./AuthenticationHeader.js"; import c from "./AuthenticationWrapper.js"; import "react"; import { jsx as l, jsxs as u } from "react/jsx-runtime"; //#region src/ui/authentication/ResetPassword.tsx var d = (d) => { let { className: f, hasError: p = !1, hasSuccess: m = !1, onSubmit: h, verifying: g = !1, redirectToLogin: _, redirectToLoginDelay: v = 3e3 } = d, y = !g && m; return y && setTimeout(() => _(), v), /* @__PURE__ */ l(i, { maxWidth: 600, children: /* @__PURE__ */ u(c, { className: f, children: [ /* @__PURE__ */ l(s, { children: "Reset password" }), g && /* @__PURE__ */ l(t, { icon: /* @__PURE__ */ l(e, {}), title: "Verifying..." }), y && /* @__PURE__ */ l("div", { role: "alert", children: /* @__PURE__ */ l(t, { status: "success", subTitle: "Redirecting you to login screen...", title: "Password successfully changed" }) }), !m && !g && /* @__PURE__ */ u(o, { errorMessage: "Something went wrong!", hasError: p, onSubmit: h, submitButtonLabel: "Set new password", children: [ p && /* @__PURE__ */ l(a, { type: "danger", children: "The most likely scenario is that you have already used this link to reset your password. If that is not the case, please contact the system administrator." }), /* @__PURE__ */ l(a, { children: "Please provide your new password in the fields below." }), /* @__PURE__ */ l(n.Item, { label: "New password", name: "password", rules: [{ required: !0, message: "New password is required" }], children: /* @__PURE__ */ l(r, { placeholder: "Enter new password", type: "password" }) }), /* @__PURE__ */ l(n.Item, { label: "Confirm new password", name: "confirmPassword", rules: [{ required: !0, message: "Please confirm your new password!" }, ({ getFieldValue: e }) => ({ validator(t, n) { return !n || e("password") === n ? Promise.resolve() : Promise.reject(/* @__PURE__ */ Error("The two passwords that you entered do not match!")); } })], children: /* @__PURE__ */ l(r, { placeholder: "Enter new password again", type: "password" }) }) ] }) ] }) }); }; //#endregion export { d as default };