Skip to content

Commit

Permalink
[MM-53249] Allow server to hide or customize the Forgot Password link
Browse files Browse the repository at this point in the history
  • Loading branch information
devinbinnie committed Jun 27, 2023
1 parent 72f7c63 commit 179f380
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/screens/login/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {Keyboard, TextInput, TouchableOpacity, View} from 'react-native';
import Button from 'react-native-button';

import {login} from '@actions/remote/session';
import {tryOpenURL} from '@app/utils/url';
import CompassIcon from '@components/compass_icon';
import FloatingTextInput from '@components/floating_text_input_label';
import FormattedText from '@components/formatted_text';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -334,7 +340,7 @@ const LoginForm = ({config, extra, serverDisplayName, launchError, launchType, l
endAdornment={endAdornment}
/>

{(emailEnabled || usernameEnabled) && (
{(emailEnabled || usernameEnabled) && config.PasswordEnableForgotLink === 'true' && (
<Button
onPress={onPressForgotPassword}
containerStyle={[styles.forgotPasswordBtn, error ? styles.forgotPasswordError : undefined]}
Expand Down
2 changes: 2 additions & 0 deletions types/api/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ interface ClientConfig {
FeatureFlagCollapsedThreads?: string;
FeatureFlagGraphQL?: string;
FeatureFlagPostPriority?: string;
ForgotPasswordLink?: string;
GfycatApiKey: string;
GfycatApiSecret: string;
GoogleDeveloperKey: string;
Expand All @@ -146,6 +147,7 @@ interface ClientConfig {
MinimumHashtagLength: string;
OpenIdButtonColor: string;
OpenIdButtonText: string;
PasswordEnableForgotLink: string;
PasswordMinimumLength: string;
PasswordRequireLowercase: string;
PasswordRequireNumber: string;
Expand Down

0 comments on commit 179f380

Please sign in to comment.