feat: basic support for Keycloak (OIDC)
This commit is contained in:
@@ -12,6 +12,7 @@ interface FormData {
|
||||
}
|
||||
|
||||
const emailEnabled = process.env.NEXT_PUBLIC_EMAIL_PROVIDER;
|
||||
const keycloakEnabled = process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED;
|
||||
|
||||
export default function Login() {
|
||||
const [submitLoader, setSubmitLoader] = useState(false);
|
||||
@@ -47,6 +48,18 @@ export default function Login() {
|
||||
}
|
||||
}
|
||||
|
||||
async function loginUserKeycloak() {
|
||||
setSubmitLoader(true);
|
||||
|
||||
const load = toast.loading("Authenticating...");
|
||||
|
||||
const res = await signIn("keycloak", {});
|
||||
|
||||
toast.dismiss(load);
|
||||
|
||||
setSubmitLoader(false);
|
||||
}
|
||||
|
||||
return (
|
||||
<CenteredForm text="Sign in to your account">
|
||||
<form onSubmit={loginUser}>
|
||||
@@ -102,6 +115,15 @@ export default function Login() {
|
||||
className=" w-full text-center"
|
||||
loading={submitLoader}
|
||||
/>
|
||||
{process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === "true" ? (
|
||||
<SubmitButton
|
||||
type="button"
|
||||
onClick={loginUserKeycloak}
|
||||
label="Sign in with Keycloak"
|
||||
className=" w-full text-center"
|
||||
loading={submitLoader}
|
||||
/>
|
||||
) : undefined}
|
||||
{process.env.NEXT_PUBLIC_DISABLE_REGISTRATION ===
|
||||
"true" ? undefined : (
|
||||
<div className="flex items-baseline gap-1 justify-center">
|
||||
|
||||
Reference in New Issue
Block a user