diff options
author | Jonathan <jonfritz@gmail.com> | 2017-07-31 12:55:49 -0400 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-07-31 17:55:49 +0100 |
commit | ed62660e96528920b0ecb8c755265c6c8d2756c4 (patch) | |
tree | 0e108934e1c2ae1e0b6eb3a29690902d33f8b32f | |
parent | 251f000c68ed384923d3b2bc6b3caea9aef2a089 (diff) | |
download | chat-ed62660e96528920b0ecb8c755265c6c8d2756c4.tar.gz chat-ed62660e96528920b0ecb8c755265c6c8d2756c4.tar.bz2 chat-ed62660e96528920b0ecb8c755265c6c8d2756c4.zip |
PLT-7185: Double clicking Create Account attempts to create an account twice (#7025)
* PLT-7185: Disabled submit button after it is clicked for the first time, unless an error occurs
* PLT-7140: Removed all static function decorators that I previously added to jsx files. These were suggested by eslint, but can cause issues for functions that override parent functionality. still can't reproduce the errors seen on spinmint locally, so I'm guessing at this point
(cherry picked from commit 34b87fe88a7e1c05ce97324861124e531a8a840b)
-rw-r--r-- | webapp/components/signup/components/signup_email.jsx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/webapp/components/signup/components/signup_email.jsx b/webapp/components/signup/components/signup_email.jsx index 872439eda..bcf47b825 100644 --- a/webapp/components/signup/components/signup_email.jsx +++ b/webapp/components/signup/components/signup_email.jsx @@ -138,7 +138,10 @@ export default class SignupEmail extends React.Component { if (err.id === 'api.user.login.not_verified.app_error') { browserHistory.push('/should_verify_email?email=' + encodeURIComponent(user.email) + '&teamname=' + encodeURIComponent(this.state.teamName)); } else { - this.setState({serverError: err.message}); + this.setState({ + serverError: err.message, + isSubmitting: false + }); } } ); @@ -222,12 +225,18 @@ export default class SignupEmail extends React.Component { handleSubmit(e) { e.preventDefault(); + // bail out if a submission is already in progress + if (this.state.isSubmitting) { + return; + } + if (this.isUserValid()) { this.setState({ nameError: '', emailError: '', passwordError: '', - serverError: '' + serverError: '', + isSubmitting: true }); const user = { @@ -243,7 +252,10 @@ export default class SignupEmail extends React.Component { this.state.inviteId, this.handleSignupSuccess.bind(this, user), (err) => { - this.setState({serverError: err.message}); + this.setState({ + serverError: err.message, + isSubmitting: false + }); } ); } @@ -388,6 +400,7 @@ export default class SignupEmail extends React.Component { type='submit' onClick={this.handleSubmit} className='btn-primary btn' + disabled={this.state.isSubmitting} > <FormattedMessage id='signup_user_completed.create' |