0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-24 22:05:56 -05:00

fix(console): preview forgot password (#2358)

This commit is contained in:
wangsijie 2022-11-09 16:28:58 +08:00 committed by GitHub
parent ac97fb75b0
commit 0a50fef379
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
import type { LanguageTag } from '@logto/language-kit';
import { languages as uiLanguageNameMapping } from '@logto/language-kit';
import type { ConnectorResponse, ConnectorMetadata, SignInExperience } from '@logto/schemas';
import { AppearanceMode } from '@logto/schemas';
import { ConnectorType, AppearanceMode } from '@logto/schemas';
import { conditional } from '@silverhand/essentials';
import classNames from 'classnames';
import { format } from 'date-fns';
@ -94,6 +94,14 @@ const Preview = ({ signInExperience, className }: Props) => {
[]
);
const hasEmailConnector = allConnectors.some(
({ type, enabled }) => enabled && type === ConnectorType.Email
);
const hasSmsConnector = allConnectors.some(
({ type, enabled }) => enabled && type === ConnectorType.Sms
);
return {
signInExperience: {
...signInExperience,
@ -103,6 +111,10 @@ const Preview = ({ signInExperience, className }: Props) => {
mode,
platform: platform === 'desktopWeb' ? 'web' : 'mobile',
isNative: platform === 'mobile',
forgotPassword: {
email: hasEmailConnector,
sms: hasSmsConnector,
},
};
}, [allConnectors, language, mode, platform, signInExperience]);