|
|
@ -6,10 +6,6 @@ export default class Code extends Component { |
|
|
|
super(props); |
|
|
|
super(props); |
|
|
|
|
|
|
|
|
|
|
|
this.state = { |
|
|
|
this.state = { |
|
|
|
auth_code1: '', |
|
|
|
|
|
|
|
auth_code2: '', |
|
|
|
|
|
|
|
auth_code3: '', |
|
|
|
|
|
|
|
auth_code4: '', |
|
|
|
|
|
|
|
flag: false, |
|
|
|
flag: false, |
|
|
|
resendStatus: false, |
|
|
|
resendStatus: false, |
|
|
|
}; |
|
|
|
}; |
|
|
@ -23,19 +19,21 @@ export default class Code extends Component { |
|
|
|
|
|
|
|
|
|
|
|
changeValue = (e) => { |
|
|
|
changeValue = (e) => { |
|
|
|
if (e.target.value.match('^[0-9]{1}$')) { |
|
|
|
if (e.target.value.match('^[0-9]{1}$')) { |
|
|
|
this.setState({ |
|
|
|
if (e.target.name === 'o1') { |
|
|
|
[e.target.name]: e.target.value, |
|
|
|
if(typeof this.state.o1 === Number){ |
|
|
|
}); |
|
|
|
console.log(e.target.value); |
|
|
|
if (e.target.name === 'auth_code1') { |
|
|
|
}else{ |
|
|
|
this.setState({ o1: e.target.value }); |
|
|
|
this.setState({ o1 : e.target.value }); |
|
|
|
|
|
|
|
} |
|
|
|
this.inputRef2.focus(); |
|
|
|
this.inputRef2.focus(); |
|
|
|
} else if (e.target.name === 'auth_code2') { |
|
|
|
} else if (e.target.name === 'o2') { |
|
|
|
this.setState({ o2: e.target.value }); |
|
|
|
this.setState({ o2: e.target.value }); |
|
|
|
this.inputRef3.focus(); |
|
|
|
this.inputRef3.focus(); |
|
|
|
} else if (e.target.name === 'auth_code3') { |
|
|
|
} else if (e.target.name === 'o3') { |
|
|
|
this.setState({ o3: e.target.value }); |
|
|
|
this.setState({ o3: e.target.value }); |
|
|
|
this.inputRef4.focus(); |
|
|
|
this.inputRef4.focus(); |
|
|
|
} else if (e.target.name === 'auth_code4') { |
|
|
|
} else if (e.target.name === 'o4') { |
|
|
|
|
|
|
|
this.setState({ o4: e.target.value }); |
|
|
|
const o4 = e.target.value; |
|
|
|
const o4 = e.target.value; |
|
|
|
const { o1, o2, o3 } = this.state; |
|
|
|
const { o1, o2, o3 } = this.state; |
|
|
|
this.props.parent.setState({ otp: `${o1}${o2}${o3}${o4}` }); |
|
|
|
this.props.parent.setState({ otp: `${o1}${o2}${o3}${o4}` }); |
|
|
@ -51,15 +49,15 @@ export default class Code extends Component { |
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
[e.target.name]: '', |
|
|
|
[e.target.name]: '', |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (e.target.name === 'auth_code1') { |
|
|
|
if (e.target.name === 'o1') { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else if (e.target.name === 'auth_code2') { |
|
|
|
} else if (e.target.name === 'o2') { |
|
|
|
this.inputRef1.focus(); |
|
|
|
this.inputRef1.focus(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else if (e.target.name === 'auth_code3') { |
|
|
|
} else if (e.target.name === 'o3') { |
|
|
|
this.inputRef2.focus(); |
|
|
|
this.inputRef2.focus(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else if (e.target.name === 'auth_code4') { |
|
|
|
} else if (e.target.name === 'o4') { |
|
|
|
this.inputRef3.focus(); |
|
|
|
this.inputRef3.focus(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -70,6 +68,17 @@ export default class Code extends Component { |
|
|
|
this.inputRef1.focus(); |
|
|
|
this.inputRef1.focus(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onInput= (e) => { |
|
|
|
|
|
|
|
e.target.value = e.target.value |
|
|
|
|
|
|
|
.replace(/[\u0660-\u0669\u06f0-\u06f9]/g, function (c) { |
|
|
|
|
|
|
|
return c.charCodeAt(0) & 0xf; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.replace(/[^\d]/, '') |
|
|
|
|
|
|
|
.slice(-1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
@ -79,55 +88,63 @@ export default class Code extends Component { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="login-code__bottom d-flex"> |
|
|
|
<div className="login-code__bottom d-flex"> |
|
|
|
<input |
|
|
|
<input |
|
|
|
name="auth_code1" |
|
|
|
name="o1" |
|
|
|
type="number" |
|
|
|
type="text" |
|
|
|
onChange={(e) => this.changeValue(e)} |
|
|
|
onChange={(e) => this.changeValue(e)} |
|
|
|
maxLength="1" |
|
|
|
maxLength="2" |
|
|
|
|
|
|
|
inputMode="numeric" |
|
|
|
ref={(input) => { |
|
|
|
ref={(input) => { |
|
|
|
this.inputRef1 = input; |
|
|
|
this.inputRef1 = input; |
|
|
|
}} |
|
|
|
}} |
|
|
|
autoComplete="false" |
|
|
|
autoComplete="false" |
|
|
|
value={this.state.auth_code1} |
|
|
|
value={this.state.o1} |
|
|
|
onKeyDown={(e) => this.keyboardEvent(e)} |
|
|
|
onKeyDown={(e) => this.keyboardEvent(e)} |
|
|
|
|
|
|
|
onInput={this.onInput} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<input |
|
|
|
<input |
|
|
|
name="auth_code2" |
|
|
|
name="o2" |
|
|
|
type="number" |
|
|
|
type="text" |
|
|
|
onChange={(e) => this.changeValue(e)} |
|
|
|
onChange={(e) => this.changeValue(e)} |
|
|
|
maxLength="1" |
|
|
|
maxLength="2" |
|
|
|
|
|
|
|
inputMode="numeric" |
|
|
|
ref={(input) => { |
|
|
|
ref={(input) => { |
|
|
|
this.inputRef2 = input; |
|
|
|
this.inputRef2 = input; |
|
|
|
}} |
|
|
|
}} |
|
|
|
autoComplete="false" |
|
|
|
autoComplete="false" |
|
|
|
value={this.state.auth_code2} |
|
|
|
value={this.state.o2} |
|
|
|
onKeyDown={(e) => this.keyboardEvent(e)} |
|
|
|
onKeyDown={(e) => this.keyboardEvent(e)} |
|
|
|
|
|
|
|
onInput={this.onInput} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<input |
|
|
|
<input |
|
|
|
name="auth_code3" |
|
|
|
name="o3" |
|
|
|
type="number" |
|
|
|
type="text" |
|
|
|
onChange={(e) => this.changeValue(e)} |
|
|
|
onChange={(e) => this.changeValue(e)} |
|
|
|
maxLength="1" |
|
|
|
maxLength="2" |
|
|
|
|
|
|
|
inputMode="numeric" |
|
|
|
ref={(input) => { |
|
|
|
ref={(input) => { |
|
|
|
this.inputRef3 = input; |
|
|
|
this.inputRef3 = input; |
|
|
|
}} |
|
|
|
}} |
|
|
|
autoComplete="false" |
|
|
|
autoComplete="false" |
|
|
|
value={this.state.auth_code3} |
|
|
|
value={this.state.o3} |
|
|
|
onKeyDown={(e) => this.keyboardEvent(e)} |
|
|
|
onKeyDown={(e) => this.keyboardEvent(e)} |
|
|
|
|
|
|
|
onInput={this.onInput} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<input |
|
|
|
<input |
|
|
|
name="auth_code4" |
|
|
|
name="o4" |
|
|
|
type="number" |
|
|
|
type="text" |
|
|
|
onChange={(e) => this.changeValue(e)} |
|
|
|
onChange={(e) => this.changeValue(e)} |
|
|
|
maxLength="1" |
|
|
|
maxLength="2" |
|
|
|
|
|
|
|
inputMode="numeric" |
|
|
|
ref={(input) => { |
|
|
|
ref={(input) => { |
|
|
|
this.inputRef4 = input; |
|
|
|
this.inputRef4 = input; |
|
|
|
}} |
|
|
|
}} |
|
|
|
autoComplete="false" |
|
|
|
autoComplete="false" |
|
|
|
value={this.state.auth_code4} |
|
|
|
value={this.state.o4} |
|
|
|
onKeyDown={(e) => this.keyboardEvent(e)} |
|
|
|
onKeyDown={(e) => this.keyboardEvent(e)} |
|
|
|
|
|
|
|
onInput={this.onInput} |
|
|
|
/> |
|
|
|
/> |
|
|
|
{!this.state.resendStatus ? ( |
|
|
|
{!this.state.resendStatus ? ( |
|
|
|
<Timer seconds={119} parent={this} /> |
|
|
|
<Timer seconds={5} parent={this} /> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<span |
|
|
|
<span |
|
|
|
style={{ top: 150, color: 'blue', textDecoration: 'underline' }} |
|
|
|
style={{ top: 150, color: 'blue', textDecoration: 'underline' }} |
|
|
|