From 8eb94b89a2e6fe0a5aefeb94db0e6372537f12f1 Mon Sep 17 00:00:00 2001 From: Treasure Ajefu Date: Tue, 29 Nov 2022 22:18:12 +0100 Subject: [PATCH 1/3] feat: added base otp code --- src/pages/VerifyNumber.jsx | 107 +++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 src/pages/VerifyNumber.jsx diff --git a/src/pages/VerifyNumber.jsx b/src/pages/VerifyNumber.jsx new file mode 100644 index 0000000..4a0b070 --- /dev/null +++ b/src/pages/VerifyNumber.jsx @@ -0,0 +1,107 @@ +import React from 'react'; + +class Otpinput extends React.Component { + constructor(props) { + super(props); + this.state = { value: '', otp1: '', otp2: '', otp3: '', otp4: '', otp5: '', disable: true }; + this.handleChange = this.handleChange.bind(this); + this.handleSubmit = this.handleSubmit.bind(this); + } + + handleChange(value1, event) { + this.setState({ [value1]: event.target.value }); + } + + handleSubmit(event) { + const data = new FormData(event.target); + console.log(this.state); + event.preventDefault(); + } + + inputfocus = (elmnt) => { + if (elmnt.key === 'Delete' || elmnt.key === 'Backspace') { + const next = elmnt.target.tabIndex - 2; + if (next > -1) { + elmnt.target.form.elements[next].focus(); + } + } else { + console.log('next'); + + const next = elmnt.target.tabIndex; + if (next < 5) { + elmnt.target.form.elements[next].focus(); + } + } + }; + + render() { + return ( +
+
+ this.handleChange('otp1', e)} + tabIndex="1" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + this.handleChange('otp2', e)} + tabIndex="2" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + this.handleChange('otp3', e)} + tabIndex="3" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + this.handleChange('otp4', e)} + tabIndex="4" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + + this.handleChange('otp5', e)} + tabIndex="5" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> +
+ +
+ ); + } +} + +export default Otpinput; From 01c9de22c39b618bc3c278259dda749dbc2378fe Mon Sep 17 00:00:00 2001 From: Treasure Ajefu Date: Wed, 30 Nov 2022 15:07:55 +0100 Subject: [PATCH 2/3] feat: developed verify by number page --- src/App.js | 3 +- src/pages/VerifyNumber.jsx | 154 +++++++++++++++++++++---------------- 2 files changed, 90 insertions(+), 67 deletions(-) diff --git a/src/App.js b/src/App.js index 9b33013..874ba35 100644 --- a/src/App.js +++ b/src/App.js @@ -1,7 +1,8 @@ +import VerifyNumber from './pages/VerifyNumber'; function App() { return (
-

Welcome to the fintech App

+
); } diff --git a/src/pages/VerifyNumber.jsx b/src/pages/VerifyNumber.jsx index 4a0b070..dd2448c 100644 --- a/src/pages/VerifyNumber.jsx +++ b/src/pages/VerifyNumber.jsx @@ -1,5 +1,5 @@ import React from 'react'; - +import Button from '../components/General/Button/Button'; class Otpinput extends React.Component { constructor(props) { super(props); @@ -13,9 +13,9 @@ class Otpinput extends React.Component { } handleSubmit(event) { - const data = new FormData(event.target); + new FormData(event.target); console.log(this.state); - event.preventDefault(); + event.preventDefault; } inputfocus = (elmnt) => { @@ -36,70 +36,92 @@ class Otpinput extends React.Component { render() { return ( -
-
- this.handleChange('otp1', e)} - tabIndex="1" - maxLength="1" - onKeyUp={(e) => this.inputfocus(e)} - /> - this.handleChange('otp2', e)} - tabIndex="2" - maxLength="1" - onKeyUp={(e) => this.inputfocus(e)} - /> - this.handleChange('otp3', e)} - tabIndex="3" - maxLength="1" - onKeyUp={(e) => this.inputfocus(e)} - /> - this.handleChange('otp4', e)} - tabIndex="4" - maxLength="1" - onKeyUp={(e) => this.inputfocus(e)} - /> +
+
+
+

+ Verify your Identity +

+

+ Enter the verification code sent to your phone number ending in -57 +

+ +
+ this.handleChange('otp1', e)} + tabIndex="1" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + this.handleChange('otp2', e)} + tabIndex="2" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + this.handleChange('otp3', e)} + tabIndex="3" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + this.handleChange('otp4', e)} + tabIndex="4" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> - this.handleChange('otp5', e)} - tabIndex="5" - maxLength="1" - onKeyUp={(e) => this.inputfocus(e)} - /> -
- - + this.handleChange('otp5', e)} + tabIndex="5" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> +
+
+

+ Didn't recieve code? Resend +

+ 30s +
+ + + +
+

Use another method to recieve the code

+

Sign in to a different account

+
+ +
); } } From 58794cf58b5246e186430b9ef0d0bfca72b8d447 Mon Sep 17 00:00:00 2001 From: Treasure Ajefu Date: Wed, 30 Nov 2022 15:11:07 +0100 Subject: [PATCH 3/3] feat: developed verify by email page --- src/App.js | 3 +- src/pages/VerifyEmail.jsx | 129 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 src/pages/VerifyEmail.jsx diff --git a/src/App.js b/src/App.js index 874ba35..9b33013 100644 --- a/src/App.js +++ b/src/App.js @@ -1,8 +1,7 @@ -import VerifyNumber from './pages/VerifyNumber'; function App() { return (
- +

Welcome to the fintech App

); } diff --git a/src/pages/VerifyEmail.jsx b/src/pages/VerifyEmail.jsx new file mode 100644 index 0000000..d766e21 --- /dev/null +++ b/src/pages/VerifyEmail.jsx @@ -0,0 +1,129 @@ +import React from 'react'; +import Button from '../components/General/Button/Button'; +class Otpinput extends React.Component { + constructor(props) { + super(props); + this.state = { value: '', otp1: '', otp2: '', otp3: '', otp4: '', otp5: '', disable: true }; + this.handleChange = this.handleChange.bind(this); + this.handleSubmit = this.handleSubmit.bind(this); + } + + handleChange(value1, event) { + this.setState({ [value1]: event.target.value }); + } + + handleSubmit(event) { + new FormData(event.target); + console.log(this.state); + event.preventDefault; + } + + inputfocus = (elmnt) => { + if (elmnt.key === 'Delete' || elmnt.key === 'Backspace') { + const next = elmnt.target.tabIndex - 2; + if (next > -1) { + elmnt.target.form.elements[next].focus(); + } + } else { + console.log('next'); + + const next = elmnt.target.tabIndex; + if (next < 5) { + elmnt.target.form.elements[next].focus(); + } + } + }; + + render() { + return ( +
+
+
+

+ Verify your Identity +

+

+ Enter the verification code sent to your email jan****@g****.com +

+
+
+ this.handleChange('otp1', e)} + tabIndex="1" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + this.handleChange('otp2', e)} + tabIndex="2" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + this.handleChange('otp3', e)} + tabIndex="3" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + this.handleChange('otp4', e)} + tabIndex="4" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> + + this.handleChange('otp5', e)} + tabIndex="5" + maxLength="1" + onKeyUp={(e) => this.inputfocus(e)} + /> +
+
+

+ Didn't recieve code? Resend +

+ 30s +
+ +
+
+
+

Use another method to recieve the code

+

Sign in to a different account

+
+
+
+ ); + } +} + +export default Otpinput;