Merge pull request #5629 from PunitLodha/punit/add_email_bug_fix
Add email only if the verification is completepull/21833/head
						commit
						9a56a2efa5
					
				|  | @ -178,19 +178,23 @@ export default class EmailAddresses extends React.Component { | |||
|         e.preventDefault(); | ||||
| 
 | ||||
|         this.setState({continueDisabled: true}); | ||||
|         this.state.addTask.checkEmailLinkClicked().then(() => { | ||||
|             const email = this.state.newEmailAddress; | ||||
|         this.state.addTask.checkEmailLinkClicked().then(([finished]) => { | ||||
|             let newEmailAddress = this.state.newEmailAddress; | ||||
|             if (finished) { | ||||
|                 const email = this.state.newEmailAddress; | ||||
|                 const emails = [ | ||||
|                     ...this.props.emails, | ||||
|                     { address: email, medium: "email" }, | ||||
|                 ]; | ||||
|                 this.props.onEmailsChange(emails); | ||||
|                 newEmailAddress = ""; | ||||
|             } | ||||
|             this.setState({ | ||||
|                 addTask: null, | ||||
|                 continueDisabled: false, | ||||
|                 verifying: false, | ||||
|                 newEmailAddress: "", | ||||
|                 newEmailAddress, | ||||
|             }); | ||||
|             const emails = [ | ||||
|                 ...this.props.emails, | ||||
|                 { address: email, medium: "email" }, | ||||
|             ]; | ||||
|             this.props.onEmailsChange(emails); | ||||
|         }).catch((err) => { | ||||
|             this.setState({continueDisabled: false}); | ||||
|             const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); | ||||
|  |  | |||
|  | @ -177,21 +177,25 @@ export default class PhoneNumbers extends React.Component { | |||
|         this.setState({continueDisabled: true}); | ||||
|         const token = this.state.newPhoneNumberCode; | ||||
|         const address = this.state.verifyMsisdn; | ||||
|         this.state.addTask.haveMsisdnToken(token).then(() => { | ||||
|         this.state.addTask.haveMsisdnToken(token).then(([finished]) => { | ||||
|             let newPhoneNumber = this.state.newPhoneNumber; | ||||
|             if (finished) { | ||||
|                 const msisdns = [ | ||||
|                     ...this.props.msisdns, | ||||
|                     { address, medium: "msisdn" }, | ||||
|                 ]; | ||||
|                 this.props.onMsisdnsChange(msisdns); | ||||
|                 newPhoneNumber = ""; | ||||
|             } | ||||
|             this.setState({ | ||||
|                 addTask: null, | ||||
|                 continueDisabled: false, | ||||
|                 verifying: false, | ||||
|                 verifyMsisdn: "", | ||||
|                 verifyError: null, | ||||
|                 newPhoneNumber: "", | ||||
|                 newPhoneNumber, | ||||
|                 newPhoneNumberCode: "", | ||||
|             }); | ||||
|             const msisdns = [ | ||||
|                 ...this.props.msisdns, | ||||
|                 { address, medium: "msisdn" }, | ||||
|             ]; | ||||
|             this.props.onMsisdnsChange(msisdns); | ||||
|         }).catch((err) => { | ||||
|             this.setState({continueDisabled: false}); | ||||
|             if (err.errcode !== 'M_THREEPID_AUTH_FAILED') { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 J. Ryan Stinnett
						J. Ryan Stinnett