diff --git a/examples/nextjs-spa/src/pages/settings.tsx b/examples/nextjs-spa/src/pages/settings.tsx index ec27b320..c86f8835 100644 --- a/examples/nextjs-spa/src/pages/settings.tsx +++ b/examples/nextjs-spa/src/pages/settings.tsx @@ -117,7 +117,7 @@ const Settings: NextPageWithLayout = () => { key={index} // we always need to pass the component the flow since it contains the form fields, error messages and csrf token flow={flow} - flowType={flowType} + method={flowType} // include scripts for webauthn support includeScripts={true} // submit the form data the user provides to Ory diff --git a/examples/preact-spa/src/settings.tsx b/examples/preact-spa/src/settings.tsx index 84adebeb..620c82a2 100644 --- a/examples/preact-spa/src/settings.tsx +++ b/examples/preact-spa/src/settings.tsx @@ -83,7 +83,7 @@ export const Settings = () => { onSubmit(body)} /> diff --git a/examples/react-spa/src/Settings.tsx b/examples/react-spa/src/Settings.tsx index 4675161a..ad340efe 100644 --- a/examples/react-spa/src/Settings.tsx +++ b/examples/react-spa/src/Settings.tsx @@ -89,7 +89,7 @@ export const Settings = () => { key={index} // we always need to pass the component the flow since it contains the form fields, error messages and csrf token flow={flow} - flowType={flowType} + method={flowType} // include scripts for webauthn support includeScripts={true} // submit the form data the user provides to Ory diff --git a/src/locales/de.json b/src/locales/de.json index 8b2f9f02..25d7812e 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -150,6 +150,7 @@ "registration.login-label": "Sie haben bereits ein Konto?", "registration.subtitle-oauth2": "Zur Authentifizierung bei {clientName}", "registration.title": "Konto registrieren", + "settings.navigation-back-button": "Zurück", "settings.navigation-backup-codes": "2FA-Backup-Codes", "settings.navigation-logout": "Abmelden", "settings.navigation-oidc": "Soziale Medien", diff --git a/src/locales/en.json b/src/locales/en.json index 9c522544..06c919ee 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -150,6 +150,7 @@ "registration.login-label": "Already have an account?", "registration.subtitle-oauth2": "To authenticate {clientName}", "registration.title": "Register an account", + "settings.navigation-back-button": "Back", "settings.navigation-backup-codes": "2FA Backup Codes", "settings.navigation-logout": "Logout", "settings.navigation-oidc": "Social Sign In", diff --git a/src/locales/es.json b/src/locales/es.json index 2975f386..913dc42c 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -150,6 +150,7 @@ "registration.login-label": "¿Ya tiene una cuenta?", "registration.subtitle-oauth2": "Para autenticar a {clientName}", "registration.title": "Registrar una cuenta", + "settings.navigation-back-button": "Regresar", "settings.navigation-backup-codes": "Códigos de Respaldo de 2FA", "settings.navigation-logout": "Cerrar sesión", "settings.navigation-oidc": "Inicio de Sesión Social", diff --git a/src/locales/fr.json b/src/locales/fr.json index c796445d..f68c60dd 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -150,6 +150,7 @@ "registration.login-label": "Vous avez déjà un compte ?", "registration.subtitle-oauth2": "Pour vous authentifier sur {clientName}", "registration.title": "Créer un compte", + "settings.navigation-back-button": "Revenir en arrière", "settings.navigation-backup-codes": "Codes de secours 2FA", "settings.navigation-logout": "Déconnexion", "settings.navigation-oidc": "Connexion sociale", diff --git a/src/locales/nl.json b/src/locales/nl.json index 2aaaee0c..a99a5152 100644 --- a/src/locales/nl.json +++ b/src/locales/nl.json @@ -150,6 +150,7 @@ "registration.login-label": "Heb je al een account?", "registration.subtitle-oauth2": "Om te authenticeren bij {clientName}", "registration.title": "Registreer een account", + "settings.navigation-back-button": "Ga terug", "settings.navigation-backup-codes": "2FA Backupcodes", "settings.navigation-logout": "Uitloggen", "settings.navigation-oidc": "Sociaal Inloggen", diff --git a/src/locales/pl.json b/src/locales/pl.json index 9f7f8f40..c39a2721 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -150,6 +150,7 @@ "registration.login-label": "Posiadasz już konto?", "registration.subtitle-oauth2": "Do autentykacji {clientName}", "registration.title": "Zarejestruj konto", + "settings.navigation-back-button": "Cofnij", "settings.navigation-backup-codes": "Kody zapasowe 2FA", "settings.navigation-logout": "Wyloguj", "settings.navigation-oidc": "Zewnętrzne logowanie", diff --git a/src/locales/pt.json b/src/locales/pt.json index 790a22ef..9d6b7b28 100644 --- a/src/locales/pt.json +++ b/src/locales/pt.json @@ -150,6 +150,7 @@ "registration.login-label": "Já tem uma conta?", "registration.subtitle-oauth2": "Para autenticar {clientName}", "registration.title": "Registar uma conta", + "settings.navigation-back-button": "Voltar", "settings.navigation-backup-codes": "Códigos de Backup de 2FA", "settings.navigation-logout": "Sair", "settings.navigation-oidc": "login social", diff --git a/src/locales/se.json b/src/locales/se.json index 020f9664..447c54b3 100644 --- a/src/locales/se.json +++ b/src/locales/se.json @@ -150,6 +150,7 @@ "registration.login-label": "Har du redan ett konto?", "registration.subtitle-oauth2": "Att autentisera {clientName}", "registration.title": "Skapa ett konto", + "settings.navigation-back-button": "Tillbaka", "settings.navigation-backup-codes": "2FA backupkoder", "settings.navigation-logout": "Logga ut", "settings.navigation-oidc": "Social Inloggning", diff --git a/src/markup-components/components.ts b/src/markup-components/components.ts index cc8ca5b8..c5a1fdba 100644 --- a/src/markup-components/components.ts +++ b/src/markup-components/components.ts @@ -36,6 +36,7 @@ import { PasswordSettingsSection as passwordSettingsSection, ProfileSettingsProps, ProfileSettingsSection as profileSettingsSection, + SettingScreenNavigationProps, ThemeProvider as themeProvider, ThemeProviderProps, TOTPSettingsProps, @@ -136,10 +137,15 @@ export const UserSettingsCard = ( export const UserSettingsScreen = ( props: UserSettingsScreenProps, + navProps: SettingScreenNavigationProps, context: Context = {}, ) => { return { - Nav: ComponentWrapper(userSettingsScreen.Nav, props, context), + Nav: ComponentWrapper( + userSettingsScreen.Nav, + { ...props, ...navProps }, + context, + ), Body: ComponentWrapper(userSettingsScreen.Body, props, context), } } diff --git a/src/react-components/ory/user-settings-card.tsx b/src/react-components/ory/user-settings-card.tsx index 4b205a76..ca89e0cd 100644 --- a/src/react-components/ory/user-settings-card.tsx +++ b/src/react-components/ory/user-settings-card.tsx @@ -22,6 +22,7 @@ import { ProfileSettingsSection } from "./sections/profile-settings-section" import { TOTPSettingsSection } from "./sections/totp-settings-section" import { WebAuthnSettingsSection } from "./sections/webauthn-settings-section" import { useIntl } from "react-intl" +import { Divider } from "../divider" export type UserSettingsFlowType = | "profile" @@ -33,19 +34,21 @@ export type UserSettingsFlowType = export type UserSettingsCardProps = { flow: SettingsFlow - flowType: UserSettingsFlowType + method: UserSettingsFlowType title?: string includeScripts?: boolean className?: string + dividerClassName?: string } & UserAuthFormAdditionalProps export const UserSettingsCard = ({ flow, - flowType, + method, title, includeScripts, onSubmit, className, + dividerClassName, }: UserSettingsCardProps): JSX.Element | null => { const intl = useIntl() @@ -57,7 +60,7 @@ export const UserSettingsCard = ({ let $flow: JSX.Element | null = null let cardTitle = "" - switch (flowType) { + switch (method) { case "profile": hasFlow = true cardTitle = @@ -133,25 +136,28 @@ export const UserSettingsCard = ({ } return hasFlow ? ( -
- {cardTitle && ( -

+
+ {cardTitle && ( +

+ {cardTitle} +

+ )} + - {cardTitle} -

- )} - - {$flow} - -
+ {$flow} + + + + ) : null } diff --git a/src/react-components/ory/user-settings-screen.tsx b/src/react-components/ory/user-settings-screen.tsx index 34c1183b..1a2931d3 100644 --- a/src/react-components/ory/user-settings-screen.tsx +++ b/src/react-components/ory/user-settings-screen.tsx @@ -32,11 +32,19 @@ export interface UserSettingsScreenProps { logoutUrl: string } -const nav = ({ +export interface SettingScreenNavigationProps { + navClassName?: string + flow: SettingsFlow + logoutUrl: string + backUrl?: string +} + +const SettingScreenNavigation = ({ navClassName, flow, logoutUrl, -}: Pick) => { + backUrl, +}: SettingScreenNavigationProps) => { const intl = useIntl() return (