Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InvestCustomer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Giang Tran
InvestCustomer
Commits
0dd06b5b
Commit
0dd06b5b
authored
Mar 16, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
connect api fogot password
parent
06ebeb35
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
160 additions
and
30 deletions
+160
-30
ConfirmEmail.js
src/Screens/Authen/ConfirmEmail.js
+33
-10
ConfirmOTP.js
src/Screens/Authen/ConfirmOTP.js
+40
-7
Login.js
src/Screens/Authen/Login.js
+4
-4
NewPassWord.js
src/Screens/Authen/NewPassWord.js
+46
-4
SettingView.js
src/Screens/Setting/SettingView.js
+18
-4
users.js
src/apis/Functions/users.js
+15
-0
url.js
src/apis/url.js
+4
-1
No files found.
src/Screens/Authen/ConfirmEmail.js
View file @
0dd06b5b
...
@@ -5,32 +5,51 @@ import {
...
@@ -5,32 +5,51 @@ import {
TextInput
,
TextInput
,
StyleSheet
,
StyleSheet
,
TouchableOpacity
,
TouchableOpacity
,
Platform
,
Alert
,
}
from
'react-native'
;
}
from
'react-native'
;
import
HeaderBack
from
'../../components/Header/HeaderBack'
;
import
HeaderBack
from
'../../components/Header/HeaderBack'
;
import
{
connect
}
from
'react-redux'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
R
from
'../../assets/R'
;
import
R
from
'../../assets/R'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
CONFIRMOTP
}
from
'../../routers/ScreenNames'
;
import
{
CONFIRMOTP
}
from
'../../routers/ScreenNames'
;
import
{
getOTPApi
}
from
'../../apis/Functions/users'
;
import
{
showLoading
,
hideLoading
}
from
'../../actions/loadingAction'
;
const
ConfirmEmail
=
(
props
)
=>
{
const
ConfirmEmail
=
(
props
)
=>
{
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
value
,
setValue
]
=
useState
(
''
);
const
navigate
=
useNavigation
();
const
navigate
=
useNavigation
();
const
getOTP
=
async
()
=>
{
if
(
value
)
{
props
.
showLoading
();
const
res
=
await
getOTPApi
({
platform
:
Platform
.
OS
,
otp_by
:
value
,
});
props
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
navigate
.
navigate
(
CONFIRMOTP
,
{
email
:
value
});
}
else
{
Alert
.
alert
(
res
.
data
.
message
);
}
}
else
{
Alert
.
alert
(
'Vui lòng nhập email!'
);
}
};
return
(
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
HeaderBack
title
=
{
'Quên mật khẩu'
}
/
>
<
HeaderBack
title
=
{
'Quên mật khẩu'
}
/
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
wrap
}
>
<
View
style
=
{
styles
.
wrap
}
>
<
View
style
=
{
styles
.
containerCode
}
>
<
View
style
=
{
styles
.
containerCode
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
Vui
l
ò
ng
nh
ậ
p
email
:
<
/Text
>
Vui
l
ò
ng
nh
ậ
p
email
ho
ặ
c
s
ố
đ
i
ệ
n
tho
ạ
i
<
/Text
>
<
TextInput
<
TextInput
style
=
{
styles
.
txtInput
}
style
=
{
styles
.
txtInput
}
placeholder
=
"Nhập
Email hoặc số điện thoại
"
placeholder
=
"Nhập
email
"
value
=
{
value
}
value
=
{
value
}
onChangeText
=
{(
val
)
=>
setValue
(
val
)}
onChangeText
=
{(
val
)
=>
setValue
(
val
)}
/
>
/
>
...
@@ -39,9 +58,7 @@ const ConfirmEmail = (props) => {
...
@@ -39,9 +58,7 @@ const ConfirmEmail = (props) => {
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
footer
}
>
<
View
style
=
{
styles
.
footer
}
>
<
TouchableOpacity
<
TouchableOpacity
onPress
=
{
getOTP
}
style
=
{
styles
.
btn
}
>
onPress
=
{()
=>
navigate
.
navigate
(
CONFIRMOTP
)}
style
=
{
styles
.
btn
}
>
<
Text
style
=
{
styles
.
txtBtn
}
>
L
ấ
y
m
ã
x
á
c
th
ự
c
<
/Text
>
<
Text
style
=
{
styles
.
txtBtn
}
>
L
ấ
y
m
ã
x
á
c
th
ự
c
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
navigate
.
goBack
()}
>
<
TouchableOpacity
onPress
=
{()
=>
navigate
.
goBack
()}
>
...
@@ -115,4 +132,10 @@ const styles = StyleSheet.create({
...
@@ -115,4 +132,10 @@ const styles = StyleSheet.create({
},
},
});
});
export
default
ConfirmEmail
;
const
mapStateToProps
=
(
state
)
=>
{
return
{};
};
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
ConfirmEmail
,
);
src/Screens/Authen/ConfirmOTP.js
View file @
0dd06b5b
...
@@ -5,6 +5,8 @@ import {
...
@@ -5,6 +5,8 @@ import {
TextInput
,
TextInput
,
StyleSheet
,
StyleSheet
,
TouchableOpacity
,
TouchableOpacity
,
Platform
,
Alert
,
}
from
'react-native'
;
}
from
'react-native'
;
import
HeaderBack
from
'../../components/Header/HeaderBack'
;
import
HeaderBack
from
'../../components/Header/HeaderBack'
;
...
@@ -17,16 +19,19 @@ import {
...
@@ -17,16 +19,19 @@ import {
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
R
from
'../../assets/R'
;
import
R
from
'../../assets/R'
;
import
{
NEWPASSWORD
}
from
'../../routers/ScreenNames'
;
import
{
NEWPASSWORD
}
from
'../../routers/ScreenNames'
;
import
{
verifyOTPApi
}
from
'../../apis/Functions/users'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
showLoading
,
hideLoading
}
from
'../../actions/loadingAction'
;
import
{
connect
}
from
'react-redux'
;
const
CELL_COUNT
=
4
;
const
CELL_COUNT
=
4
;
const
ConfirmOTP
=
(
propsa
)
=>
{
const
ConfirmOTP
=
(
propsa
)
=>
{
const
[
value
,
setValue
]
=
useState
(
''
);
const
[
value
,
setValue
]
=
useState
(
''
);
const
navigate
=
useNavigation
();
const
navigate
=
useNavigation
();
console
.
log
(
'test'
);
console
.
log
(
propsa
.
route
.
params
.
email
);
const
ref
=
useBlurOnFulfill
({
value
,
cellCount
:
CELL_COUNT
});
const
ref
=
useBlurOnFulfill
({
value
,
cellCount
:
CELL_COUNT
});
const
[
props
,
getCellOnLayoutHandler
]
=
useClearByFocusCell
({
const
[
props
,
getCellOnLayoutHandler
]
=
useClearByFocusCell
({
...
@@ -34,9 +39,35 @@ const ConfirmOTP = (propsa) => {
...
@@ -34,9 +39,35 @@ const ConfirmOTP = (propsa) => {
setValue
,
setValue
,
});
});
const
confirm
=
async
()
=>
{
if
(
!
value
)
{
Alert
.
alert
(
'Vui long nhập mã OTP'
);
}
else
if
(
value
.
length
!=
4
)
{
Alert
.
alert
(
'Mã OTP không đúng định dạng'
);
}
else
{
propsa
.
showLoading
();
const
res
=
await
verifyOTPApi
({
platform
:
Platform
.
OS
,
receiver_name
:
propsa
.
route
.
params
.
email
,
otp
:
value
,
});
propsa
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
navigate
.
navigate
(
NEWPASSWORD
,
{
otp
:
value
,
email
:
propsa
.
route
.
params
.
email
,
});
}
else
{
Alert
(
res
.
data
.
message
);
}
}
};
return
(
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
HeaderBack
title
=
{
'
Quên mật khẩu
'
}
/
>
<
HeaderBack
title
=
{
'
Xác thưc OTP
'
}
/
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{{
height
:
20
}}
/
>
<
View
style
=
{{
height
:
20
}}
/
>
...
@@ -68,9 +99,7 @@ const ConfirmOTP = (propsa) => {
...
@@ -68,9 +99,7 @@ const ConfirmOTP = (propsa) => {
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
footer
}
>
<
View
style
=
{
styles
.
footer
}
>
<
TouchableOpacity
<
TouchableOpacity
onPress
=
{
confirm
}
style
=
{
styles
.
btn
}
>
onPress
=
{()
=>
navigate
.
navigate
(
NEWPASSWORD
)}
style
=
{
styles
.
btn
}
>
<
Text
style
=
{
styles
.
txtBtn
}
>
Ti
ế
p
t
ụ
c
<
/Text
>
<
Text
style
=
{
styles
.
txtBtn
}
>
Ti
ế
p
t
ụ
c
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
console
.
log
(
'Hello'
)}
>
<
TouchableOpacity
onPress
=
{()
=>
console
.
log
(
'Hello'
)}
>
...
@@ -155,4 +184,8 @@ const styles = StyleSheet.create({
...
@@ -155,4 +184,8 @@ const styles = StyleSheet.create({
},
},
});
});
export
default
ConfirmOTP
;
const
mapStateToProps
=
(
state
)
=>
{
return
{};
};
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
ConfirmOTP
);
src/Screens/Authen/Login.js
View file @
0dd06b5b
...
@@ -29,8 +29,8 @@ import {connect} from 'react-redux';
...
@@ -29,8 +29,8 @@ import {connect} from 'react-redux';
const
Login
=
(
props
)
=>
{
const
Login
=
(
props
)
=>
{
const
{
navigation
}
=
props
;
const
{
navigation
}
=
props
;
const
[
email
,
setEmail
]
=
useState
(
'
Tdgiang@dcv.vn
'
);
const
[
email
,
setEmail
]
=
useState
(
''
);
const
[
pass
,
setPass
]
=
useState
(
'
123456
'
);
const
[
pass
,
setPass
]
=
useState
(
''
);
const
navigate
=
useNavigation
();
const
navigate
=
useNavigation
();
...
@@ -61,10 +61,10 @@ const Login = (props) => {
...
@@ -61,10 +61,10 @@ const Login = (props) => {
routes
:
[{
name
:
TABNAVIGATOR
}],
routes
:
[{
name
:
TABNAVIGATOR
}],
});
});
}
else
{
}
else
{
Alert
.
alert
(
'Thông báo!'
,
res
.
data
.
message
);
Alert
.
alert
(
res
.
data
.
message
);
}
}
}
else
{
}
else
{
Alert
.
alert
(
'
Thông báo!'
,
'
Vui lòng điền '
+
titles
[
index
]);
Alert
.
alert
(
'Vui lòng điền '
+
titles
[
index
]);
}
}
};
};
...
...
src/Screens/Authen/NewPassWord.js
View file @
0dd06b5b
...
@@ -5,16 +5,54 @@ import {
...
@@ -5,16 +5,54 @@ import {
TextInput
,
TextInput
,
StyleSheet
,
StyleSheet
,
TouchableOpacity
,
TouchableOpacity
,
Alert
,
Platform
,
}
from
'react-native'
;
}
from
'react-native'
;
import
HeaderBack
from
'../../components/Header/HeaderBack'
;
import
HeaderBack
from
'../../components/Header/HeaderBack'
;
import
{
forgotPasswordApi
}
from
'../../apis/Functions/users'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
R
from
'../../assets/R'
;
import
R
from
'../../assets/R'
;
import
{
AUTHEN
}
from
'../../routers/ScreenNames'
;
import
{
showLoading
,
hideLoading
}
from
'../../actions/loadingAction'
;
import
{
connect
}
from
'react-redux'
;
const
NewPassword
=
(
props
)
=>
{
const
NewPassword
=
(
props
)
=>
{
const
[
password
,
setPassword
]
=
useState
(
''
);
const
[
password
,
setPassword
]
=
useState
(
''
);
const
[
cfPassword
,
setcfPassword
]
=
useState
(
''
);
const
[
cfPassword
,
setcfPassword
]
=
useState
(
''
);
const
navigate
=
useNavigation
();
const
{
email
,
otp
}
=
props
.
route
.
params
;
const
changePass
=
async
()
=>
{
if
(
!
password
||
!
cfPassword
)
{
Alert
.
alert
(
'Vui lòng điền đầy đủ thông tin!'
);
}
else
{
props
.
showLoading
();
const
res
=
await
forgotPasswordApi
({
receiver_name
:
email
,
otp
,
password
,
password_confirmation
:
cfPassword
,
platform
:
Platform
.
OS
,
});
props
.
hideLoading
();
console
.
log
(
res
.
data
);
if
(
res
.
data
.
code
==
200
)
{
navigate
.
reset
({
index
:
1
,
routes
:
[{
name
:
AUTHEN
}],
});
}
else
{
Alert
.
alert
(
res
.
data
.
message
);
}
}
};
return
(
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
HeaderBack
title
=
{
'Thay đổi mật khẩu mới'
}
/
>
<
HeaderBack
title
=
{
'Thay đổi mật khẩu mới'
}
/
>
...
@@ -45,9 +83,7 @@ const NewPassword = (props) => {
...
@@ -45,9 +83,7 @@ const NewPassword = (props) => {
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
footer
}
>
<
View
style
=
{
styles
.
footer
}
>
<
TouchableOpacity
<
TouchableOpacity
onPress
=
{
changePass
}
style
=
{
styles
.
btn
}
>
onPress
=
{()
=>
console
.
log
(
'Hello'
)}
style
=
{
styles
.
btn
}
>
<
Text
style
=
{
styles
.
txtBtn
}
>
C
ậ
p
nh
ậ
t
<
/Text
>
<
Text
style
=
{
styles
.
txtBtn
}
>
C
ậ
p
nh
ậ
t
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
...
@@ -123,4 +159,10 @@ const styles = StyleSheet.create({
...
@@ -123,4 +159,10 @@ const styles = StyleSheet.create({
},
},
});
});
export
default
NewPassword
;
const
mapStateToProps
=
(
state
)
=>
{
return
{};
};
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
NewPassword
,
);
src/Screens/Setting/SettingView.js
View file @
0dd06b5b
import
React
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
{
View
,
Text
}
from
'react-native'
;
import
{
View
,
Text
,
Switch
}
from
'react-native'
;
import
HeaderBack
from
'../../components/Header/HeaderBack'
;
const
SettingView
=
(
props
)
=>
{
const
SettingView
=
(
props
)
=>
{
const
[
isEnabled
,
setIsEnabled
]
=
useState
(
false
);
const
toggleSwitch
=
()
=>
setIsEnabled
((
previousState
)
=>
!
previousState
);
return
(
return
(
<
View
>
<
View
style
=
{{
flex
:
1
}}
>
<
Text
>
SettingView
screen
<
/Text
>
<
HeaderBack
title
=
{
'Cài đặt'
}
/
>
<
View
style
=
{{
flexDirection
:
'row'
}}
><
/View
>
<
Switch
trackColor
=
{{
false
:
'#767577'
,
true
:
'#1C6AF6'
}}
// thumbColor={isEnabled ? '#f5dd4b' : '#f4f3f4'}
ios_backgroundColor
=
"#767577"
onValueChange
=
{
toggleSwitch
}
value
=
{
isEnabled
}
/
>
<
Text
>
SettingView
1
screen
<
/Text
>
<
/View
>
<
/View
>
);
);
};
};
...
...
src/apis/Functions/users.js
View file @
0dd06b5b
...
@@ -16,3 +16,18 @@ export const logoutApi = async (body) =>
...
@@ -16,3 +16,18 @@ export const logoutApi = async (body) =>
PostData
(
'http://api.dcvinvest.com/api/auth/logout'
,
body
)
PostData
(
'http://api.dcvinvest.com/api/auth/logout'
,
body
)
.
then
((
res
)
=>
res
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
.
catch
((
err
)
=>
err
);
export
const
getOTPApi
=
async
(
body
)
=>
PostLogin
(
url
.
urlGetOTP
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
export
const
verifyOTPApi
=
async
(
body
)
=>
PostLogin
(
url
.
urlVerifyOTP
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
export
const
forgotPasswordApi
=
async
(
body
)
=>
PostLogin
(
url
.
urlForgotPassword
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
src/apis/url.js
View file @
0dd06b5b
const
root
=
'http://api.dcvinvest.com/'
;
const
root
=
'http://api.dcvinvest.com/'
;
export
default
{
export
default
{
urllogin
:
root
+
'
/
api/auth/customer-login'
,
urllogin
:
root
+
'api/auth/customer-login'
,
urlRegistor
:
root
+
'api/auth/customer-register'
,
urlRegistor
:
root
+
'api/auth/customer-register'
,
urlGetListMethod
:
root
+
'api/v1/payments/get-list-deposit-method'
,
urlGetListMethod
:
root
+
'api/v1/payments/get-list-deposit-method'
,
urlGetOTP
:
root
+
'api/auth/customer-get-otp'
,
urlVerifyOTP
:
root
+
'api/auth/customer-verify-otp'
,
urlForgotPassword
:
root
+
'api/auth/customer-forgot-password'
,
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment