mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
email resend requests limited to once per thirty seconds
This commit is contained in:
parent
2311fbdaae
commit
9fb13975b4
1 changed files with 17 additions and 4 deletions
|
@ -4,7 +4,7 @@ import Button from 'component/button';
|
||||||
import UserSignOutButton from 'component/userSignOutButton';
|
import UserSignOutButton from 'component/userSignOutButton';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
import Card from 'component/common/card';
|
import Card from 'component/common/card';
|
||||||
|
const THIRTY_SECONDS_IN_MS = 30000;
|
||||||
type Props = {
|
type Props = {
|
||||||
email: string,
|
email: string,
|
||||||
isReturningUser: boolean,
|
isReturningUser: boolean,
|
||||||
|
@ -17,10 +17,15 @@ type Props = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
class UserEmailVerify extends React.PureComponent<Props> {
|
type State = {
|
||||||
|
wait: boolean,
|
||||||
|
};
|
||||||
|
|
||||||
|
class UserEmailVerify extends React.PureComponent<Props, State> {
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.emailVerifyCheckInterval = null;
|
this.emailVerifyCheckInterval = null;
|
||||||
|
this.state = { wait: false };
|
||||||
(this: any).handleResendVerificationEmail = this.handleResendVerificationEmail.bind(this);
|
(this: any).handleResendVerificationEmail = this.handleResendVerificationEmail.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +51,16 @@ class UserEmailVerify extends React.PureComponent<Props> {
|
||||||
|
|
||||||
handleResendVerificationEmail() {
|
handleResendVerificationEmail() {
|
||||||
const { email, resendVerificationEmail, toast } = this.props;
|
const { email, resendVerificationEmail, toast } = this.props;
|
||||||
resendVerificationEmail(email);
|
if (!this.state.wait) {
|
||||||
toast(__('New email sent.'));
|
resendVerificationEmail(email);
|
||||||
|
toast(__('New email sent.'));
|
||||||
|
this.setState({
|
||||||
|
wait: true,
|
||||||
|
});
|
||||||
|
setTimeout(() => this.setState({ wait: false }), THIRTY_SECONDS_IN_MS);
|
||||||
|
} else {
|
||||||
|
toast(__('Please wait a bit longer before requesting again.'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkIfVerified() {
|
checkIfVerified() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue