mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
fix(console): parse onboarding sie config (#3535)
This commit is contained in:
parent
9614edce17
commit
497f244858
1 changed files with 16 additions and 7 deletions
|
@ -46,8 +46,17 @@ const onboardSieConfigToSignInExperience = (
|
|||
const { logo, color: onboardConfigColor, identifier, authentications, socialTargets } = config;
|
||||
const { color: baseColorConfig, branding: baseBranding } = basedConfig;
|
||||
|
||||
const isPasswordSetup = authentications.includes(Authentication.Password);
|
||||
const isVerificationCodeSetup = identifier !== SignInIdentifier.Username;
|
||||
// Map to sign-up config
|
||||
const shouldSetPasswordAtSignUp =
|
||||
identifier === SignInIdentifier.Username || authentications.includes(Authentication.Password);
|
||||
const shouldVerifyAtSignUp = identifier !== SignInIdentifier.Username;
|
||||
|
||||
// Map to sign-in methods
|
||||
const isSignInByPasswordEnabled =
|
||||
identifier === SignInIdentifier.Username || authentications.includes(Authentication.Password);
|
||||
const isSignInByVerificationCodeEnabled =
|
||||
identifier !== SignInIdentifier.Username &&
|
||||
authentications.includes(Authentication.VerificationCode);
|
||||
|
||||
const signInExperience: SignInExperience = {
|
||||
...basedConfig,
|
||||
|
@ -62,16 +71,16 @@ const onboardSieConfigToSignInExperience = (
|
|||
},
|
||||
signUp: {
|
||||
identifiers: [identifier],
|
||||
password: isPasswordSetup,
|
||||
verify: isVerificationCodeSetup,
|
||||
verify: shouldVerifyAtSignUp,
|
||||
password: shouldSetPasswordAtSignUp,
|
||||
},
|
||||
signIn: {
|
||||
methods: [
|
||||
{
|
||||
identifier,
|
||||
password: isPasswordSetup,
|
||||
verificationCode: isVerificationCodeSetup,
|
||||
isPasswordPrimary: isPasswordSetup,
|
||||
password: isSignInByPasswordEnabled,
|
||||
verificationCode: isSignInByVerificationCodeEnabled,
|
||||
isPasswordPrimary: isSignInByPasswordEnabled,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue