diff --git a/src/common/pages/Otp/index.js b/src/common/pages/Otp/index.js index 0da308b..b159bbc 100644 --- a/src/common/pages/Otp/index.js +++ b/src/common/pages/Otp/index.js @@ -54,7 +54,7 @@ class OtpPage extends React.Component{ } componentDidMount(){ - this.otp[0].focus(); + setTimeout(() => this.otp[0].focus(), 500); if(this.urlParams.has('login_request_id') && this.urlParams.has('expired_at')) { console.log(this.urlParams); this.setState({ @@ -159,17 +159,6 @@ class OtpPage extends React.Component{ - {/* - - - - Welcome to BTN Points - - - Sign in to get various voucher and items - - - */} @@ -181,7 +170,23 @@ class OtpPage extends React.Component{ {[0, 1, 2, 3, 4, 5].map(x => ( - this.setState({otpText:this.state.otpText+event.target.value})} autoFocus={true} ref={(input) => { this.otp[x] = input; }} key={x} id={x} inputStyle={{textAlign:'center'}} style={{width:'100%'}} type="tel" maxLength="1"/> + { + + if (event.target.value !== '') { + this.setState({otpText:this.state.otpText+event.target.value}, () => { + if (x < 5) { + this.otp[x+1].focus(); + } else { + this.login(); + } + }); + } else { + const otpText = this.state.otpText.split(""); + otpText[x] = ""; + this.setState({otpText:otpText.join("")}); + } + + }} autoFocus={x === 0} ref={(input) => { this.otp[x] = input; }} key={x} id={x} inputStyle={{textAlign:'center'}} style={{width:'100%'}} type="tel" maxLength="1"/> ))} diff --git a/src/common/pages/RegisterNew/index.js b/src/common/pages/RegisterNew/index.js index 99aa30a..3374b5f 100644 --- a/src/common/pages/RegisterNew/index.js +++ b/src/common/pages/RegisterNew/index.js @@ -135,13 +135,14 @@ class RegisterPage extends React.Component { if (this.state.password.length < 8) { return message.warning("password need atleast 8 characters"); } - // if (this.state.upload_photo === '') { - // return message.warning("please upload photo"); - // } - // - // if (this.state.upload_ktp === '') { - // return message.warning("please upload ktp"); - // } + + // if (this.state.upload_photo === '') { + // return message.warning("please upload photo"); + //} +// + //if (this.state.upload_ktp === '') { + // return message.warning("please upload ktp"); + //} this.setState({ isLoading: true });