2024-06-09 08:27:07 +02:00
|
|
|
import { getKcClsx } from "keycloakify/login/lib/kcClsx";
|
2024-06-05 21:13:58 +02:00
|
|
|
import type { PageProps } from "keycloakify/login/pages/PageProps";
|
|
|
|
import type { KcContext } from "../KcContext";
|
2024-06-09 11:20:45 +02:00
|
|
|
import type { I18n } from "../i18n";
|
2021-03-07 14:57:53 +01:00
|
|
|
|
2024-06-09 11:20:45 +02:00
|
|
|
export default function LoginResetPassword(props: PageProps<Extract<KcContext, { pageId: "login-reset-password.ftl" }>, I18n>) {
|
|
|
|
const { kcContext, i18n, doUseDefaultCss, Template, classes } = props;
|
2023-03-18 06:14:05 +01:00
|
|
|
|
2024-06-09 08:27:07 +02:00
|
|
|
const { kcClsx } = getKcClsx({
|
2023-03-21 05:27:31 +01:00
|
|
|
doUseDefaultCss,
|
2023-03-18 06:14:05 +01:00
|
|
|
classes
|
|
|
|
});
|
2021-08-20 17:03:50 +02:00
|
|
|
|
2024-05-11 17:17:35 +02:00
|
|
|
const { url, realm, auth, messagesPerField } = kcContext;
|
2021-08-20 17:03:50 +02:00
|
|
|
|
2024-06-09 11:20:45 +02:00
|
|
|
const { msg, msgStr } = i18n;
|
2022-10-13 11:58:31 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Template
|
2024-06-09 08:27:07 +02:00
|
|
|
kcContext={kcContext}
|
2024-06-09 11:20:45 +02:00
|
|
|
i18n={i18n}
|
2024-06-09 08:27:07 +02:00
|
|
|
doUseDefaultCss={doUseDefaultCss}
|
|
|
|
classes={classes}
|
2024-05-11 17:17:35 +02:00
|
|
|
displayInfo
|
|
|
|
displayMessage={!messagesPerField.existsError("username")}
|
|
|
|
infoNode={realm.duplicateEmailsAllowed ? msg("emailInstructionUsername") : msg("emailInstruction")}
|
2022-10-13 11:58:31 +02:00
|
|
|
headerNode={msg("emailForgotTitle")}
|
2023-03-21 02:36:13 +01:00
|
|
|
>
|
2024-06-09 08:27:07 +02:00
|
|
|
<form id="kc-reset-password-form" className={kcClsx("kcFormClass")} action={url.loginAction} method="post">
|
|
|
|
<div className={kcClsx("kcFormGroupClass")}>
|
|
|
|
<div className={kcClsx("kcLabelWrapperClass")}>
|
|
|
|
<label htmlFor="username" className={kcClsx("kcLabelClass")}>
|
2023-03-21 02:36:13 +01:00
|
|
|
{!realm.loginWithEmailAllowed
|
|
|
|
? msg("username")
|
|
|
|
: !realm.registrationEmailAsUsername
|
2024-05-20 19:30:15 +02:00
|
|
|
? msg("usernameOrEmail")
|
|
|
|
: msg("email")}
|
2023-03-21 02:36:13 +01:00
|
|
|
</label>
|
|
|
|
</div>
|
2024-06-09 08:27:07 +02:00
|
|
|
<div className={kcClsx("kcInputWrapperClass")}>
|
2023-03-21 02:36:13 +01:00
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
id="username"
|
|
|
|
name="username"
|
2024-06-09 08:27:07 +02:00
|
|
|
className={kcClsx("kcInputClass")}
|
2023-03-21 02:36:13 +01:00
|
|
|
autoFocus
|
2024-05-11 17:17:35 +02:00
|
|
|
defaultValue={auth.attemptedUsername ?? ""}
|
|
|
|
aria-invalid={messagesPerField.existsError("username")}
|
2023-03-21 02:36:13 +01:00
|
|
|
/>
|
2024-05-11 17:17:35 +02:00
|
|
|
{messagesPerField.existsError("username") && (
|
2024-06-09 08:27:07 +02:00
|
|
|
<span id="input-error-username" className={kcClsx("kcInputErrorMessageClass")} aria-live="polite">
|
2024-05-11 17:17:35 +02:00
|
|
|
{messagesPerField.get("username")}
|
|
|
|
</span>
|
|
|
|
)}
|
2022-10-13 11:58:31 +02:00
|
|
|
</div>
|
2023-03-21 02:36:13 +01:00
|
|
|
</div>
|
2024-06-09 08:27:07 +02:00
|
|
|
<div className={kcClsx("kcFormGroupClass", "kcFormSettingClass")}>
|
|
|
|
<div id="kc-form-options" className={kcClsx("kcFormOptionsClass")}>
|
|
|
|
<div className={kcClsx("kcFormOptionsWrapperClass")}>
|
2023-03-21 02:36:13 +01:00
|
|
|
<span>
|
|
|
|
<a href={url.loginUrl}>{msg("backToLogin")}</a>
|
|
|
|
</span>
|
2022-10-13 11:58:31 +02:00
|
|
|
</div>
|
2023-03-21 02:36:13 +01:00
|
|
|
</div>
|
2021-03-07 14:57:53 +01:00
|
|
|
|
2024-06-09 08:27:07 +02:00
|
|
|
<div id="kc-form-buttons" className={kcClsx("kcFormButtonsClass")}>
|
2023-03-21 02:36:13 +01:00
|
|
|
<input
|
2024-06-09 08:27:07 +02:00
|
|
|
className={kcClsx("kcButtonClass", "kcButtonPrimaryClass", "kcButtonBlockClass", "kcButtonLargeClass")}
|
2023-03-21 02:36:13 +01:00
|
|
|
type="submit"
|
|
|
|
value={msgStr("doSubmit")}
|
|
|
|
/>
|
2022-10-13 11:58:31 +02:00
|
|
|
</div>
|
2023-03-21 02:36:13 +01:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</Template>
|
2022-10-13 11:58:31 +02:00
|
|
|
);
|
2023-02-25 18:11:23 +01:00
|
|
|
}
|