Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update feedback message when the link to get a magic code is resent #15573

Merged
merged 1 commit into from
Mar 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class BaseValidateCodeForm extends React.Component {
formError: {},
validateCode: props.credentials.validateCode || '',
twoFactorAuthCode: '',
linkSent: false,
};
}

Expand Down Expand Up @@ -131,6 +132,9 @@ class BaseValidateCodeForm extends React.Component {
}
this.setState({formError: {}});
User.resendValidateCode(this.props.credentials.login, true);

// Give feedback to the user to let them know the email was sent so they don't spam the button.
this.setState({linkSent: true});
}

/**
Expand Down Expand Up @@ -212,15 +216,21 @@ class BaseValidateCodeForm extends React.Component {
autoFocus
/>
<View style={[styles.changeExpensifyLoginLinkContainer]}>
<TouchableOpacity
style={[styles.mt2]}
onPress={this.resendValidateCode}
underlayColor={themeColors.componentBG}
>
<Text style={[styles.link]}>
{this.props.translate('validateCodeForm.magicCodeNotReceived')}
{this.state.linkSent ? (
<Text style={[styles.mt2]}>
{this.props.account.message}
</Text>
</TouchableOpacity>
) : (
<TouchableOpacity
style={[styles.mt2]}
onPress={this.resendValidateCode}
underlayColor={themeColors.componentBG}
>
<Text style={[styles.link]}>
{this.props.translate('validateCodeForm.magicCodeNotReceived')}
</Text>
</TouchableOpacity>
)}
</View>
</View>
)}
Expand Down