@coko/client
Version:
Client side common code for coko apps
90 lines (89 loc) • 2.82 kB
JavaScript
import e from "../common/Form.js";
import t from "../common/FormSection.js";
import n from "../common/Input.js";
import "../common/index.js";
import r from "./ProfileForm.js";
import "react";
import i from "styled-components";
import { jsx as a, jsxs as o } from "react/jsx-runtime";
import { Col as s, Row as c } from "antd";
//#region src/ui/authentication/ChangePassword.tsx
var l = i(s)``, u = ({ children: e }) => /* @__PURE__ */ a(c, {
align: "top",
gutter: 8,
children: e
}), d = i.div``, f = (i) => {
let { className: s, form: c, loading: f = !1, message: p = "", onSubmit: m, submissionStatus: h, ...g } = i;
return /* @__PURE__ */ a(d, {
className: s,
children: /* @__PURE__ */ a(r, {
form: c,
loading: f,
message: p,
onSubmit: (e) => m(e),
submissionStatus: h,
...g,
children: /* @__PURE__ */ o(t, {
label: "Password",
last: !0,
children: [/* @__PURE__ */ a(u, { children: /* @__PURE__ */ a(l, {
sm: 12,
xs: 24,
children: /* @__PURE__ */ a(e.Item, {
label: "Current password",
name: "currentPassword",
rules: [{
required: !0,
message: "Please provide current password before changing it"
}],
children: /* @__PURE__ */ a(n, {
autoComplete: "current-password",
"data-testid": "currentPassword",
type: "password"
})
})
}) }), /* @__PURE__ */ o(u, { children: [/* @__PURE__ */ a(l, {
sm: 12,
xs: 24,
children: /* @__PURE__ */ a(e.Item, {
dependencies: ["currentPassword"],
label: "New password",
name: "newPassword",
rules: [{
required: !0,
message: "This field is required"
}, ({ getFieldValue: e }) => ({ validator(t, n) {
return n && e("currentPassword") || !n ? Promise.resolve() : Promise.reject(/* @__PURE__ */ Error("You must first provide the current password in order to change it!"));
} })],
children: /* @__PURE__ */ a(n, {
autoComplete: "new-password",
"data-testid": "newPassword",
type: "password"
})
})
}), /* @__PURE__ */ a(l, {
sm: 12,
xs: 24,
children: /* @__PURE__ */ a(e.Item, {
dependencies: ["newPassword"],
label: "Password confirmation",
name: "newPasswordConfirmation",
rules: [{
required: !0,
message: "This field is required"
}, ({ getFieldValue: e }) => ({ validator(t, n) {
return !n || e("newPassword") === n ? Promise.resolve() : Promise.reject(/* @__PURE__ */ Error("The two passwords that you entered do not match!"));
} })],
children: /* @__PURE__ */ a(n, {
autoComplete: "new-password",
"data-testid": "newPasswordConfirmation",
type: "password"
})
})
})] })]
})
})
});
};
//#endregion
export { f as default };