Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 16
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 16
22_23-J 16
Commits
0e4155f8
Commit
0e4155f8
authored
May 08, 2023
by
Ishini Kiridena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
registration backend call completed
parent
facaecd6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
111 additions
and
3 deletions
+111
-3
emma-frontend/components/patientscreens/registration/regEight.js
...ontend/components/patientscreens/registration/regEight.js
+75
-3
emma-frontend/env.js
emma-frontend/env.js
+2
-0
emma-frontend/package-lock.json
emma-frontend/package-lock.json
+11
-0
emma-frontend/package.json
emma-frontend/package.json
+1
-0
emma-frontend/services/encryptByServerKey.js
emma-frontend/services/encryptByServerKey.js
+22
-0
No files found.
emma-frontend/components/patientscreens/registration/regEight.js
View file @
0e4155f8
...
@@ -5,6 +5,8 @@ import RadioForm, {
...
@@ -5,6 +5,8 @@ import RadioForm, {
RadioButtonInput
,
RadioButtonInput
,
RadioButtonLabel
,
RadioButtonLabel
,
}
from
"
react-native-simple-radio-button
"
;
}
from
"
react-native-simple-radio-button
"
;
import
EncryptWithServerKey
from
"
../../../services/encryptByServerKey
"
;
import
{
LOCALBACKEND
}
from
"
../../../env
"
;
export
default
function
PatientRegEight
({
navigation
,
route
})
{
export
default
function
PatientRegEight
({
navigation
,
route
})
{
const
[
educationLevel
,
setEducationLevel
]
=
useState
(
""
);
const
[
educationLevel
,
setEducationLevel
]
=
useState
(
""
);
...
@@ -23,9 +25,79 @@ export default function PatientRegEight({ navigation, route }) {
...
@@ -23,9 +25,79 @@ export default function PatientRegEight({ navigation, route }) {
{
label
:
"
Self Employed
"
,
value
:
"
Self Employed
"
},
{
label
:
"
Self Employed
"
,
value
:
"
Self Employed
"
},
];
];
const
handleSave
=
()
=>
{
const
handleSave
=
async
()
=>
{
//call the method for registration
//encrypt the data
console
.
log
(
route
.
params
,
educationLevel
,
employedStatus
);
const
encryptedEmail
=
EncryptWithServerKey
(
route
.
params
.
email
);
const
encryptedUsername
=
EncryptWithServerKey
(
route
.
params
.
username
);
const
encryptedPassword
=
EncryptWithServerKey
(
route
.
params
.
password
);
const
encryptedName
=
EncryptWithServerKey
(
route
.
params
.
name
);
const
encryptedPronoun
=
EncryptWithServerKey
(
route
.
params
.
pronoun
);
const
encryptedStringDate
=
EncryptWithServerKey
(
route
.
params
.
stringDate
);
const
encryptedGender
=
EncryptWithServerKey
(
route
.
params
.
gender
);
const
encryptedOrphan
=
EncryptWithServerKey
(
route
.
params
.
orphan
);
const
encryptedSiblingCount
=
EncryptWithServerKey
(
route
.
params
.
siblingCount
);
const
encryptedRelationshipStatus
=
EncryptWithServerKey
(
route
.
params
.
relationshipStatus
);
const
encryptedNumberOfChildren
=
EncryptWithServerKey
(
route
.
params
.
numberOfChildren
);
const
encryptedSexualPreference
=
EncryptWithServerKey
(
route
.
params
.
sexualPreference
);
const
encryptedEthnicity
=
EncryptWithServerKey
(
route
.
params
.
ethnicity
);
const
encryptedReligion
=
EncryptWithServerKey
(
route
.
params
.
religion
);
const
encryptedNationality
=
EncryptWithServerKey
(
route
.
params
.
nationality
);
const
encryptedEducationLevel
=
EncryptWithServerKey
(
route
.
params
.
educationLevel
);
const
encryptedEmployedStatus
=
EncryptWithServerKey
(
route
.
params
.
employedStatus
);
//create JSON object
const
regObject
=
{
email
:
encryptedEmail
,
username
:
encryptedUsername
,
password
:
encryptedPassword
,
name
:
encryptedName
,
pronoun
:
encryptedPronoun
,
birthday
:
encryptedStringDate
,
gender
:
encryptedGender
,
orphan
:
encryptedOrphan
,
siblingcount
:
encryptedSiblingCount
,
relationship
:
encryptedRelationshipStatus
,
childcount
:
encryptedNumberOfChildren
,
sexualpreference
:
encryptedSexualPreference
,
religion
:
encryptedReligion
,
ethnicity
:
encryptedEthnicity
,
nationality
:
encryptedNationality
,
educationlevel
:
encryptedEducationLevel
,
employed
:
encryptedEmployedStatus
,
};
const
registerUrl
=
LOCALBACKEND
+
`/patient/register`
;
//call the backend endpoint
try
{
const
regResponse
=
await
fetch
(
registerUrl
,
{
method
:
"
POST
"
,
body
:
JSON
.
stringify
(
regObject
),
});
console
.
log
(
regResponse
);
const
responseData
=
await
regResponse
.
json
();
if
(
regResponse
.
ok
)
{
console
.
log
(
"
Success
"
,
responseData
);
}
else
{
console
.
log
(
responseData
);
}
}
catch
(
errorWhenSendingRegObj
)
{
console
.
error
(
"
Error :
"
,
errorWhenSendingRegObj
);
}
};
};
return
(
return
(
...
...
emma-frontend/env.js
0 → 100644
View file @
0e4155f8
export
const
AES_KEY
=
"
QfTjWnZr4u7x!A%D
"
;
export
const
LOCALBACKEND
=
"
http://192.168.8.117:4000
"
;
emma-frontend/package-lock.json
View file @
0e4155f8
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
"expo-status-bar"
:
"~1.4.4"
,
"expo-status-bar"
:
"~1.4.4"
,
"react"
:
"18.2.0"
,
"react"
:
"18.2.0"
,
"react-native"
:
"0.71.7"
,
"react-native"
:
"0.71.7"
,
"react-native-crypto-js"
:
"^1.0.0"
,
"react-native-datepicker"
:
"^1.7.2"
,
"react-native-datepicker"
:
"^1.7.2"
,
"react-native-simple-radio-button"
:
"^2.7.4"
"react-native-simple-radio-button"
:
"^2.7.4"
},
},
...
@@ -11222,6 +11223,11 @@
...
@@ -11222,6 +11223,11 @@
"nullthrows"
:
"^1.1.1"
"nullthrows"
:
"^1.1.1"
}
}
},
},
"node_modules/react-native-crypto-js"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/react-native-crypto-js/-/react-native-crypto-js-1.0.0.tgz"
,
"integrity"
:
"sha512-FNbLuG/HAdapQoybeZSoes1PWdOj0w242gb+e1R0hicf3Gyj/Mf8M9NaED2AnXVOX01b2FXomwUiw1xP1K+8sA=="
},
"node_modules/react-native-datepicker"
:
{
"node_modules/react-native-datepicker"
:
{
"version"
:
"1.7.2"
,
"version"
:
"1.7.2"
,
"resolved"
:
"https://registry.npmjs.org/react-native-datepicker/-/react-native-datepicker-1.7.2.tgz"
,
"resolved"
:
"https://registry.npmjs.org/react-native-datepicker/-/react-native-datepicker-1.7.2.tgz"
,
...
@@ -21883,6 +21889,11 @@
...
@@ -21883,6 +21889,11 @@
"nullthrows"
:
"^1.1.1"
"nullthrows"
:
"^1.1.1"
}
}
},
},
"react-native-crypto-js"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/react-native-crypto-js/-/react-native-crypto-js-1.0.0.tgz"
,
"integrity"
:
"sha512-FNbLuG/HAdapQoybeZSoes1PWdOj0w242gb+e1R0hicf3Gyj/Mf8M9NaED2AnXVOX01b2FXomwUiw1xP1K+8sA=="
},
"react-native-datepicker"
:
{
"react-native-datepicker"
:
{
"version"
:
"1.7.2"
,
"version"
:
"1.7.2"
,
"resolved"
:
"https://registry.npmjs.org/react-native-datepicker/-/react-native-datepicker-1.7.2.tgz"
,
"resolved"
:
"https://registry.npmjs.org/react-native-datepicker/-/react-native-datepicker-1.7.2.tgz"
,
...
...
emma-frontend/package.json
View file @
0e4155f8
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
"expo-status-bar"
:
"~1.4.4"
,
"expo-status-bar"
:
"~1.4.4"
,
"react"
:
"18.2.0"
,
"react"
:
"18.2.0"
,
"react-native"
:
"0.71.7"
,
"react-native"
:
"0.71.7"
,
"react-native-crypto-js"
:
"^1.0.0"
,
"react-native-datepicker"
:
"^1.7.2"
,
"react-native-datepicker"
:
"^1.7.2"
,
"react-native-simple-radio-button"
:
"^2.7.4"
"react-native-simple-radio-button"
:
"^2.7.4"
},
},
...
...
emma-frontend/services/encryptByServerKey.js
0 → 100644
View file @
0e4155f8
import
CryptoJS
from
"
react-native-crypto-js
"
;
import
{
useEffect
}
from
"
react
"
;
import
{
AES_KEY
}
from
"
../env
"
;
function
EncryptWithServerKey
(
originalTxt
)
{
const
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
AES_KEY
);
const
options
=
{
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
,
iv
:
CryptoJS
.
enc
.
Utf8
.
parse
(
AES_KEY
),
};
const
encryptedTxt
=
CryptoJS
.
AES
.
encrypt
(
originalTxt
,
key
,
options
).
toString
();
return
encryptedTxt
;
}
export
default
EncryptWithServerKey
;
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