From 21fc831554870cd005f6d629e64fb77b407fdb83 Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Tue, 18 Jul 2023 12:31:35 -0400 Subject: [PATCH] [MM-53249] Allow server to hide or customize the Forgot Password link (#7429) * [MM-53249] Allow server to hide or customize the Forgot Password link * Update app/screens/login/form.tsx Co-authored-by: Elias Nahum * Fix issue for older servers * Sort imports --------- Co-authored-by: Elias Nahum --- app/screens/login/form.tsx | 8 +++++++- types/api/config.d.ts | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/screens/login/form.tsx b/app/screens/login/form.tsx index 9c49e9201c..9bf88fd235 100644 --- a/app/screens/login/form.tsx +++ b/app/screens/login/form.tsx @@ -19,6 +19,7 @@ import {buttonBackgroundStyle, buttonTextStyle} from '@utils/buttonStyles'; import {getFullErrorMessage, isErrorWithMessage, isServerError} from '@utils/errors'; import {preventDoubleTap} from '@utils/tap'; import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; +import {tryOpenURL} from '@utils/url'; import type {LaunchProps} from '@typings/launch'; @@ -206,6 +207,11 @@ const LoginForm = ({config, extra, serverDisplayName, launchError, launchType, l }, [error]); const onPressForgotPassword = useCallback(() => { + if (config.ForgotPasswordLink) { + tryOpenURL(config.ForgotPasswordLink); + return; + } + const passProps = { theme, serverUrl, @@ -334,7 +340,7 @@ const LoginForm = ({config, extra, serverDisplayName, launchError, launchType, l endAdornment={endAdornment} /> - {(emailEnabled || usernameEnabled) && ( + {(emailEnabled || usernameEnabled) && config.PasswordEnableForgotLink !== 'false' && (