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
02afb8c4
Commit
02afb8c4
authored
Jun 11, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update code
parent
9716afe7
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
35 deletions
+71
-35
Functions.js
src/Config/Functions.js
+2
-4
NewPassWord.js
src/Screens/Authen/NewPassWord.js
+3
-2
RegisterOTP.js
src/Screens/Authen/RegisterOTP.js
+12
-6
ConfirmChangeSmartOTP.js
src/Screens/SmartOTP/ChangeSmartOTP/ConfirmChangeSmartOTP.js
+4
-3
ConfirmCreate.js
src/Screens/SmartOTP/ConfirmCreate/ConfirmCreate.js
+10
-3
ConfirmOTPSmart.js
src/Screens/SmartOTP/ConfirmOTPSmart.js
+5
-2
EnterPasswordSmartOTP.js
src/Screens/SmartOTP/EnterPasswordSmartOTP.js
+8
-4
SmartOTP.js
src/Screens/SmartOTP/SmartOTP.js
+17
-8
ConfirmOTPSmart.js
src/apis/Functions/ConfirmOTPSmart.js
+10
-3
No files found.
src/Config/Functions.js
View file @
02afb8c4
...
@@ -20,17 +20,15 @@ import JSEncrypt from 'jsencrypt';
...
@@ -20,17 +20,15 @@ import JSEncrypt from 'jsencrypt';
export
const
encryptRSAString
=
(
val
)
=>
{
export
const
encryptRSAString
=
(
val
)
=>
{
var
encrypt
=
new
JSEncrypt
();
var
encrypt
=
new
JSEncrypt
();
encrypt
.
setPublicKey
(
MY_
RSA_KEY
.
publicKey
);
encrypt
.
setPublicKey
(
RSA_KEY
.
publicKey
);
var
encrypted
=
encrypt
.
encrypt
(
val
);
var
encrypted
=
encrypt
.
encrypt
(
val
);
console
.
log
(
'Ma hoa'
,
encrypted
);
return
encrypted
;
return
encrypted
;
};
};
export
const
decryptRSAString
=
(
val
)
=>
{
export
const
decryptRSAString
=
(
val
)
=>
{
var
decrypt
=
new
JSEncrypt
();
var
decrypt
=
new
JSEncrypt
();
decrypt
.
setPrivateKey
(
RSA_KEY
.
privateKey
);
decrypt
.
setPrivateKey
(
MY_
RSA_KEY
.
privateKey
);
var
uncrypted
=
decrypt
.
decrypt
(
val
);
var
uncrypted
=
decrypt
.
decrypt
(
val
);
console
.
log
(
'giai hoa'
,
uncrypted
);
return
uncrypted
;
return
uncrypted
;
};
};
...
...
src/Screens/Authen/NewPassWord.js
View file @
02afb8c4
...
@@ -20,6 +20,7 @@ import I18n from '../../helper/i18/i18n';
...
@@ -20,6 +20,7 @@ import I18n from '../../helper/i18/i18n';
import
{
showLoading
,
hideLoading
}
from
'../../actions/loadingAction'
;
import
{
showLoading
,
hideLoading
}
from
'../../actions/loadingAction'
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
showAlert
,
TYPE
}
from
'../../components/DropdownAlert'
;
import
{
showAlert
,
TYPE
}
from
'../../components/DropdownAlert'
;
import
{
encryptRSAString
}
from
'../../Config/Functions'
;
const
NewPassword
=
(
props
)
=>
{
const
NewPassword
=
(
props
)
=>
{
const
[
password
,
setPassword
]
=
useState
(
''
);
const
[
password
,
setPassword
]
=
useState
(
''
);
...
@@ -36,8 +37,8 @@ const NewPassword = (props) => {
...
@@ -36,8 +37,8 @@ const NewPassword = (props) => {
const
res
=
await
forgotPasswordApi
({
const
res
=
await
forgotPasswordApi
({
receiver_name
:
email
,
receiver_name
:
email
,
otp
,
otp
,
password
,
password
:
encryptRSAString
(
password
)
,
password_confirmation
:
cfPassword
,
password_confirmation
:
encryptRSAString
(
cfPassword
)
,
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
});
});
props
.
hideLoading
();
props
.
hideLoading
();
...
...
src/Screens/Authen/RegisterOTP.js
View file @
02afb8c4
...
@@ -16,7 +16,13 @@ import {
...
@@ -16,7 +16,13 @@ import {
useBlurOnFulfill
,
useBlurOnFulfill
,
useClearByFocusCell
,
useClearByFocusCell
,
}
from
'react-native-confirmation-code-field'
;
}
from
'react-native-confirmation-code-field'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
,
encryptRSAString
,
decryptRSAString
,
}
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
,
registorApi
,
getOTPApi
}
from
'../../apis/Functions/users'
;
import
{
verifyOTPApi
,
registorApi
,
getOTPApi
}
from
'../../apis/Functions/users'
;
...
@@ -52,7 +58,7 @@ const ConfirmOTP = (propsa) => {
...
@@ -52,7 +58,7 @@ const ConfirmOTP = (propsa) => {
const
res
=
await
verifyOTPApi
({
const
res
=
await
verifyOTPApi
({
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
receiver_name
:
propsa
.
route
.
params
.
email
,
receiver_name
:
propsa
.
route
.
params
.
email
,
otp
:
value
,
otp
:
encryptRSAString
(
value
)
,
type
:
'CUSTOMER_VERIFY'
,
type
:
'CUSTOMER_VERIFY'
,
});
});
...
@@ -68,18 +74,18 @@ const ConfirmOTP = (propsa) => {
...
@@ -68,18 +74,18 @@ const ConfirmOTP = (propsa) => {
if
(
sponsor_id
)
{
if
(
sponsor_id
)
{
res
=
await
registorApi
({
res
=
await
registorApi
({
email
,
email
,
password
,
password
:
encryptRSAString
(
password
)
,
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
password_confirmation
,
password_confirmation
:
encryptRSAString
(
password_confirmation
)
,
sponsor_id
,
sponsor_id
,
phone
,
phone
,
});
});
}
else
{
}
else
{
res
=
await
registorApi
({
res
=
await
registorApi
({
email
,
email
,
password
,
password
:
encryptRSAString
(
password
)
,
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
password_confirmation
,
password_confirmation
:
encryptRSAString
(
password_confirmation
)
,
phone
,
phone
,
});
});
}
}
...
...
src/Screens/SmartOTP/ChangeSmartOTP/ConfirmChangeSmartOTP.js
View file @
02afb8c4
...
@@ -14,6 +14,7 @@ import {
...
@@ -14,6 +14,7 @@ import {
CONFIRMCREATEOTP
,
CONFIRMCREATEOTP
,
}
from
'../../../routers/ScreenNames'
;
}
from
'../../../routers/ScreenNames'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
encryptRSAString
}
from
'../../../Config/Functions'
;
const
ConfirmChangeSmartOTP
=
(
props
)
=>
{
const
ConfirmChangeSmartOTP
=
(
props
)
=>
{
const
[
firstNumber
,
setFirstNumber
]
=
useState
(
null
);
const
[
firstNumber
,
setFirstNumber
]
=
useState
(
null
);
...
@@ -47,9 +48,9 @@ const ConfirmChangeSmartOTP = (props) => {
...
@@ -47,9 +48,9 @@ const ConfirmChangeSmartOTP = (props) => {
props
.
showLoading
();
props
.
showLoading
();
const
res
=
await
updateOTPApiSmart
({
const
res
=
await
updateOTPApiSmart
({
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
password
:
props
.
route
.
params
.
pre_otp
,
password
:
encryptRSAString
(
props
.
route
.
params
.
pre_otp
)
,
password_confirmation
:
pinCode
,
password_confirmation
:
encryptRSAString
(
pinCode
)
,
old_password
:
props
.
route
.
params
.
old_password
,
old_password
:
encryptRSAString
(
props
.
route
.
params
.
old_password
)
,
});
});
props
.
hideLoading
();
props
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
...
...
src/Screens/SmartOTP/ConfirmCreate/ConfirmCreate.js
View file @
02afb8c4
...
@@ -16,7 +16,12 @@ import {
...
@@ -16,7 +16,12 @@ import {
useBlurOnFulfill
,
useBlurOnFulfill
,
useClearByFocusCell
,
useClearByFocusCell
,
}
from
'react-native-confirmation-code-field'
;
}
from
'react-native-confirmation-code-field'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../../Config/Functions'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
,
encryptRSAString
,
}
from
'../../../Config/Functions'
;
import
R
from
'../../../assets/R'
;
import
R
from
'../../../assets/R'
;
import
{
NEWPASSWORD
,
TABNAVIGATOR
}
from
'../../../routers/ScreenNames'
;
import
{
NEWPASSWORD
,
TABNAVIGATOR
}
from
'../../../routers/ScreenNames'
;
import
{
import
{
...
@@ -75,8 +80,10 @@ const ConfirmOTP = (propsa) => {
...
@@ -75,8 +80,10 @@ const ConfirmOTP = (propsa) => {
propsa
.
showLoading
();
propsa
.
showLoading
();
const
res
=
await
verifyStoreOTPApiSmart
({
const
res
=
await
verifyStoreOTPApiSmart
({
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
password
:
propsa
.
route
.
params
.
password
,
password
:
encryptRSAString
(
propsa
.
route
.
params
.
password
),
password_confirmation
:
propsa
.
route
.
params
.
password_confirmation
,
password_confirmation
:
encryptRSAString
(
propsa
.
route
.
params
.
password_confirmation
,
),
otp
:
value
,
otp
:
value
,
type
:
'CREATE_OTP_PASSWORD'
,
type
:
'CREATE_OTP_PASSWORD'
,
});
});
...
...
src/Screens/SmartOTP/ConfirmOTPSmart.js
View file @
02afb8c4
...
@@ -23,6 +23,7 @@ import {
...
@@ -23,6 +23,7 @@ import {
verifyStoreOTPApiSmart
,
verifyStoreOTPApiSmart
,
getOTPApiSmartOTP
,
getOTPApiSmartOTP
,
}
from
'../../apis/Functions/users'
;
}
from
'../../apis/Functions/users'
;
import
{
encryptRSAString
}
from
'../../Config/Functions'
;
const
CELL_COUNT
=
4
;
const
CELL_COUNT
=
4
;
...
@@ -63,8 +64,10 @@ const ConfirmOTPSmart = (propsa) => {
...
@@ -63,8 +64,10 @@ const ConfirmOTPSmart = (propsa) => {
propsa
.
showLoading
();
propsa
.
showLoading
();
const
res
=
await
verifyStoreOTPApiSmart
({
const
res
=
await
verifyStoreOTPApiSmart
({
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
password
:
propsa
.
route
.
params
.
password
,
password
:
encryptRSAString
(
propsa
.
route
.
params
.
password
),
password_confirmation
:
propsa
.
route
.
params
.
password_confirmation
,
password_confirmation
:
encryptRSAString
(
propsa
.
route
.
params
.
password_confirmation
,
),
otp
:
value
,
otp
:
value
,
type
:
'CREATE_OTP_PASSWORD'
,
type
:
'CREATE_OTP_PASSWORD'
,
});
});
...
...
src/Screens/SmartOTP/EnterPasswordSmartOTP.js
View file @
02afb8c4
...
@@ -8,6 +8,7 @@ import {hideLoading, showLoading} from '../../actions/loadingAction';
...
@@ -8,6 +8,7 @@ import {hideLoading, showLoading} from '../../actions/loadingAction';
import
{
OTP_TYPE
}
from
'../../Config/constants'
;
import
{
OTP_TYPE
}
from
'../../Config/constants'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
RESET_SMART_OTP
,
CHANGESMARTOTP
}
from
'../../routers/ScreenNames'
;
import
{
RESET_SMART_OTP
,
CHANGESMARTOTP
}
from
'../../routers/ScreenNames'
;
import
{
decryptRSAString
,
encryptRSAString
}
from
'../../Config/Functions'
;
const
EnterPasswordSmartOTP
=
(
props
)
=>
{
const
EnterPasswordSmartOTP
=
(
props
)
=>
{
const
navigation
=
useNavigation
();
const
navigation
=
useNavigation
();
...
@@ -38,12 +39,12 @@ const EnterPasswordSmartOTP = (props) => {
...
@@ -38,12 +39,12 @@ const EnterPasswordSmartOTP = (props) => {
if
(
props
.
route
.
params
.
type
==
'CHANGE_SMART_OTP'
)
{
if
(
props
.
route
.
params
.
type
==
'CHANGE_SMART_OTP'
)
{
const
res
=
await
verifyOTPApiSmart
({
const
res
=
await
verifyOTPApiSmart
({
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
otp_password
:
pinCode
,
otp_password
:
encryptRSAString
(
pinCode
)
,
type
:
'VERIFY_OTP_PASSWORD'
,
type
:
'VERIFY_OTP_PASSWORD'
,
});
});
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
navigation
.
navigate
(
CHANGESMARTOTP
,
{
navigation
.
navigate
(
CHANGESMARTOTP
,
{
old_password
:
pinCode
,
old_password
:
encryptRSAString
(
pinCode
)
,
TYPE
:
'CHANGE_SMART_OTP'
,
TYPE
:
'CHANGE_SMART_OTP'
,
});
});
clearPIN
();
clearPIN
();
...
@@ -55,7 +56,7 @@ const EnterPasswordSmartOTP = (props) => {
...
@@ -55,7 +56,7 @@ const EnterPasswordSmartOTP = (props) => {
const
res
=
await
getOTPApiSmartOTP
({
const
res
=
await
getOTPApiSmartOTP
({
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
otp_by
:
props
.
user
.
email
,
otp_by
:
props
.
user
.
email
,
otp_password
:
pinCode
,
otp_password
:
encryptRSAString
(
pinCode
)
,
type
:
type
:
props
.
route
.
params
.
type
==
'DEPOSIT'
props
.
route
.
params
.
type
==
'DEPOSIT'
?
OTP_TYPE
.
CUSTOMER_REQUEST_DEPOSIT
?
OTP_TYPE
.
CUSTOMER_REQUEST_DEPOSIT
...
@@ -63,7 +64,10 @@ const EnterPasswordSmartOTP = (props) => {
...
@@ -63,7 +64,10 @@ const EnterPasswordSmartOTP = (props) => {
});
});
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
props
.
route
.
params
.
onGoToSmartOTP
(
pinCode
,
res
.
data
.
data
.
otp
);
props
.
route
.
params
.
onGoToSmartOTP
(
pinCode
,
decryptRSAString
(
res
.
data
.
data
.
otp
),
);
}
else
{
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
clearPIN
();
clearPIN
();
...
...
src/Screens/SmartOTP/SmartOTP.js
View file @
02afb8c4
...
@@ -11,7 +11,7 @@ import {connect} from 'react-redux';
...
@@ -11,7 +11,7 @@ import {connect} from 'react-redux';
import
{
hideLoading
,
showLoading
}
from
'../../actions/loadingAction'
;
import
{
hideLoading
,
showLoading
}
from
'../../actions/loadingAction'
;
import
{
OTP_TYPE
}
from
'../../Config/constants'
;
import
{
OTP_TYPE
}
from
'../../Config/constants'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
encryptRSAString
,
decryptRSAString
}
from
'../../Config/Functions'
;
const
SmartOTP
=
(
props
)
=>
{
const
SmartOTP
=
(
props
)
=>
{
const
[
value
,
setValue
]
=
useState
(
props
.
route
.
params
.
otp
);
const
[
value
,
setValue
]
=
useState
(
props
.
route
.
params
.
otp
);
...
@@ -31,8 +31,11 @@ const SmartOTP = (props) => {
...
@@ -31,8 +31,11 @@ const SmartOTP = (props) => {
let
res1
=
await
verifyOTPApi
({
let
res1
=
await
verifyOTPApi
({
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
receiver_name
:
props
.
user
.
email
,
receiver_name
:
props
.
user
.
email
,
otp
:
value
,
otp
:
encryptRSAString
(
value
),
type
:
props
.
route
.
params
.
type
==
'DEPOSIT'
?
OTP_TYPE
.
CUSTOMER_REQUEST_DEPOSIT
:
OTP_TYPE
.
REQUEST_WITHDRAW
,
type
:
props
.
route
.
params
.
type
==
'DEPOSIT'
?
OTP_TYPE
.
CUSTOMER_REQUEST_DEPOSIT
:
OTP_TYPE
.
REQUEST_WITHDRAW
,
});
});
if
(
res1
.
data
.
code
==
200
)
{
if
(
res1
.
data
.
code
==
200
)
{
...
@@ -80,11 +83,14 @@ const SmartOTP = (props) => {
...
@@ -80,11 +83,14 @@ const SmartOTP = (props) => {
const
res
=
await
getOTPApiSmartOTP
({
const
res
=
await
getOTPApiSmartOTP
({
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
otp_by
:
props
.
user
.
email
,
otp_by
:
props
.
user
.
email
,
otp_password
:
props
.
route
.
params
.
pinCode
,
otp_password
:
encryptRSAString
(
props
.
route
.
params
.
pinCode
),
type
:
props
.
route
.
params
.
type
==
'DEPOSIT'
?
OTP_TYPE
.
CUSTOMER_REQUEST_DEPOSIT
:
OTP_TYPE
.
REQUEST_WITHDRAW
,
type
:
props
.
route
.
params
.
type
==
'DEPOSIT'
?
OTP_TYPE
.
CUSTOMER_REQUEST_DEPOSIT
:
OTP_TYPE
.
REQUEST_WITHDRAW
,
});
});
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
setValue
(
res
.
data
.
data
.
otp
);
setValue
(
decryptRSAString
(
res
.
data
.
data
.
otp
)
);
setReset
(
!
isReset
);
setReset
(
!
isReset
);
}
else
{
}
else
{
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
showAlert
(
TYPE
.
ERROR
,
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
...
@@ -96,14 +102,17 @@ const SmartOTP = (props) => {
...
@@ -96,14 +102,17 @@ const SmartOTP = (props) => {
setProgress
(
count
>
0
?
count
/
300
:
0
);
setProgress
(
count
>
0
?
count
/
300
:
0
);
};
};
return
<
SmartOTPView
return
(
<
SmartOTPView
value
=
{
value
}
value
=
{
value
}
progress
=
{
progress
}
progress
=
{
progress
}
confirm
=
{
confirm
}
confirm
=
{
confirm
}
isReset
=
{
isReset
}
isReset
=
{
isReset
}
getNewOTP
=
{
getNewOTP
}
getNewOTP
=
{
getNewOTP
}
updateProgress
=
{
updateProgress
}
updateProgress
=
{
updateProgress
}
setValue
=
{
setValue
}
/>
;
setValue
=
{
setValue
}
/
>
);
};
};
const
mapStateToProps
=
(
state
)
=>
{
const
mapStateToProps
=
(
state
)
=>
{
return
{
return
{
...
...
src/apis/Functions/ConfirmOTPSmart.js
View file @
02afb8c4
...
@@ -16,7 +16,12 @@ import {
...
@@ -16,7 +16,12 @@ import {
useBlurOnFulfill
,
useBlurOnFulfill
,
useClearByFocusCell
,
useClearByFocusCell
,
}
from
'react-native-confirmation-code-field'
;
}
from
'react-native-confirmation-code-field'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
}
from
'../../Config/Functions'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
,
encryptRSAString
,
}
from
'../../Config/Functions'
;
import
R
from
'../../assets/R'
;
import
R
from
'../../assets/R'
;
import
{
TABNAVIGATOR
}
from
'../../routers/ScreenNames'
;
import
{
TABNAVIGATOR
}
from
'../../routers/ScreenNames'
;
import
{
verifyOTPApi
}
from
'../../apis/Functions/users'
;
import
{
verifyOTPApi
}
from
'../../apis/Functions/users'
;
...
@@ -68,8 +73,10 @@ const ConfirmOTPSmart = (propsa) => {
...
@@ -68,8 +73,10 @@ const ConfirmOTPSmart = (propsa) => {
propsa
.
showLoading
();
propsa
.
showLoading
();
const
res
=
await
verifyStoreOTPApiSmart
({
const
res
=
await
verifyStoreOTPApiSmart
({
platform
:
Platform
.
OS
,
platform
:
Platform
.
OS
,
password
:
propsa
.
route
.
params
.
password
,
password
:
encryptRSAString
(
propsa
.
route
.
params
.
password
),
password_confirmation
:
propsa
.
route
.
params
.
password_confirmation
,
password_confirmation
:
encryptRSAString
(
propsa
.
route
.
params
.
password_confirmation
,
),
otp
:
value
,
otp
:
value
,
type
:
'FORGOT_PASSWORD'
,
type
:
'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