mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 19:52:29 +00:00
show already setupped methods
This commit is contained in:
@@ -2,6 +2,8 @@ import {
|
||||
getBrandingSettings,
|
||||
getLoginSettings,
|
||||
getSession,
|
||||
getUserByID,
|
||||
listAuthenticationMethodTypes,
|
||||
server,
|
||||
} from "#/lib/zitadel";
|
||||
import Alert from "#/ui/Alert";
|
||||
@@ -34,8 +36,15 @@ export default async function Page({
|
||||
organization
|
||||
);
|
||||
return getSession(server, recent.id, recent.token).then((response) => {
|
||||
if (response?.session) {
|
||||
return response.session;
|
||||
if (response?.session && response.session.factors?.user?.id) {
|
||||
return listAuthenticationMethodTypes(
|
||||
response.session.factors.user.id
|
||||
).then((methods) => {
|
||||
return {
|
||||
factors: response.session?.factors,
|
||||
authMethods: methods.authMethodTypes ?? [],
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -43,8 +52,15 @@ export default async function Page({
|
||||
async function loadSessionById(sessionId: string, organization?: string) {
|
||||
const recent = await getSessionCookieById(sessionId, organization);
|
||||
return getSession(server, recent.id, recent.token).then((response) => {
|
||||
if (response?.session) {
|
||||
return response.session;
|
||||
if (response?.session && response.session.factors?.user?.id) {
|
||||
return listAuthenticationMethodTypes(
|
||||
response.session.factors.user.id
|
||||
).then((methods) => {
|
||||
return {
|
||||
factors: response.session?.factors,
|
||||
authMethods: methods.authMethodTypes ?? [],
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -67,19 +83,18 @@ export default async function Page({
|
||||
></UserAvatar>
|
||||
)}
|
||||
|
||||
{!sessionFactors && <div className="py-4"></div>}
|
||||
|
||||
{!(loginName || sessionId) && (
|
||||
<Alert>Provide your active session as loginName param</Alert>
|
||||
)}
|
||||
|
||||
{loginSettings ? (
|
||||
{loginSettings && sessionFactors ? (
|
||||
<ChooseSecondFactorToSetup
|
||||
loginName={loginName}
|
||||
sessionId={sessionId}
|
||||
authRequestId={authRequestId}
|
||||
organization={organization}
|
||||
loginSettings={loginSettings}
|
||||
userMethods={sessionFactors.authMethods ?? []}
|
||||
></ChooseSecondFactorToSetup>
|
||||
) : (
|
||||
<Alert>No second factors available to setup.</Alert>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { getBrandingSettings, getLoginSettings, server } from "#/lib/zitadel";
|
||||
import DynamicTheme from "#/ui/DynamicTheme";
|
||||
import LoginOTP from "#/ui/LoginOTP";
|
||||
import LoginPasskey from "#/ui/LoginPasskey";
|
||||
import VerifyU2F from "#/ui/VerifyU2F";
|
||||
|
||||
export default async function Page({
|
||||
@@ -22,12 +23,13 @@ export default async function Page({
|
||||
|
||||
<p className="ztdl-p">Verify your account with your device.</p>
|
||||
|
||||
<VerifyU2F
|
||||
<LoginPasskey
|
||||
loginName={loginName}
|
||||
sessionId={sessionId}
|
||||
authRequestId={authRequestId}
|
||||
organization={organization}
|
||||
></VerifyU2F>
|
||||
altPassword={false}
|
||||
></LoginPasskey>
|
||||
</div>
|
||||
</DynamicTheme>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user