diff --git a/src/common/pages/Login/LoginBtn.js b/src/common/pages/Login/LoginBtn.js index 99a09eb..bd06044 100644 --- a/src/common/pages/Login/LoginBtn.js +++ b/src/common/pages/Login/LoginBtn.js @@ -74,6 +74,13 @@ class BTNLoginPage extends React.Component{ else if(res.state == "email_verification"){ this.setState({isNeedEmailVerification:true,isLoading:false}); } + else if(res.state == "phone_verification"){ + this.authStore.otpData = res; + setTimeout(()=>{ + this.props.history.push(LINKS.OTP); + this.setState({isLoading:false}); + },1000); + } }).catch(err => { console.log("err login",err); this.setState({loginFailed:true,isLoading:false}); @@ -137,7 +144,7 @@ class BTNLoginPage extends React.Component{ Your account still need email verification - Still not received any email? Resend email + Still not received any email? this.authStore.resendEmail(this.state.email)}>Resend email
diff --git a/src/common/stores/authenticaton.js b/src/common/stores/authenticaton.js index d4ba8d7..4fc6016 100644 --- a/src/common/stores/authenticaton.js +++ b/src/common/stores/authenticaton.js @@ -37,6 +37,7 @@ export class Authentication { // airline_settings: [] // } }; + @observable otpData = {} constructor(context) { this.context = context; @@ -117,6 +118,30 @@ export class Authentication { }) } + @action + resendEmail(data) { + this.isRegistering = true; + return this.http.post("/resend_email_verification", data) + .then(res => { + return res; + }) + .catch(err => { + throw err; + }) + } + + @action + validateOtp(data) { + this.isRegistering = true; + return this.http.post("/validate_otp", data) + .then(res => { + return res; + }) + .catch(err => { + throw err; + }) + } + createCookie(name,value,days) { let expires if (days) {