Skip to content

Commit

Permalink
Unify skip and disable face verification env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
serdiukov-o-nordwhale committed Jun 2, 2020
1 parent cca8935 commit 1fda26d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .env.dev
Expand Up @@ -22,14 +22,13 @@ ZOOM_SERVER_BASEURL=https://api.zoomauth.com/api/v2/biometrics
ZOOM_MINIMAL_MATCHLEVEL=1
ALLOW_DUPLICATE_USER_DATA=true
SKIP_EMAIL_VERIFICATION=true
SKIP_FACE_VERIFICATION=true
DISABLE_FACE_VERIFICATION=true
# Time interval (in hours) to store face verification records after user deletes his account
KEEP_FACE_VERIFICATION_RECORDS=24
ROLLBAR_TOKEN=
MONGO_DB_URI=
WEB3_SITE_URL=https://w3.gooddollar.org
SECURE_KEY=
DISABLE_FACE_VERIFICATION=true
ENABLE_MONGO_LOCK=false
FUSE_API=https://explorer.fuse.io
TWILIO_AUTH_ID=
Expand Down
1 change: 0 additions & 1 deletion .env.example
Expand Up @@ -39,7 +39,6 @@ AWS_S3_BUCKET=1
#allow multiple users to register with same mobile/email - for testing
ALLOW_DUPLICATE_USER_DATA=true
SKIP_EMAIL_VERIFICATION=true
SKIP_FACE_VERIFICATION=false
# Time interval (in hours) to store face verification records after user deletes his account
KEEP_FACE_VERIFICATION_RECORDS=24
## Token for rollbar logging service
Expand Down
2 changes: 1 addition & 1 deletion .env.test
Expand Up @@ -23,7 +23,7 @@ ZOOM_MINIMAL_MATCHLEVEL=1
MAUTIC_URL=https://go.gooddollar.org/api
SKIP_EMAIL_VERIFICATION=false
ALLOW_DUPLICATE_USER_DATA=false
SKIP_FACE_VERIFICATION=false
DISABLE_FACE_VERIFICATION=false
# Time interval (in hours) to store face verification records after user deletes his account
KEEP_FACE_VERIFICATION_RECORDS=24
NEW_RELIC_LICENSE_KEY=ab380edbf4e6210529f4aa2513445e7f75672594
Expand Down
10 changes: 2 additions & 8 deletions src/server/server.config.js
Expand Up @@ -308,12 +308,6 @@ const conf = convict({
env: 'SKIP_EMAIL_VERIFICATION',
default: false
},
skipFaceVerification: {
doc: 'Returns FR passed with no Zoom API interaction',
format: Boolean,
env: 'SKIP_FACE_VERIFICATION',
default: false
},
keepFaceVerificationRecords: {
doc:
'Time interval (in hours) to store face verification records after user deletes his account.' +
Expand All @@ -329,10 +323,10 @@ const conf = convict({
default: false
},
disableFaceVerification: {
doc: 'Whitelist user once they register',
doc: 'Whitelist user once they register, returns already enrolled with no Zoom API interaction',
format: Boolean,
env: 'DISABLE_FACE_VERIFICATION',
default: true
default: false
},
rollbarToken: {
doc: 'access token for rollbar logging',
Expand Down
8 changes: 4 additions & 4 deletions src/server/verification/verificationAPI.js
Expand Up @@ -72,13 +72,13 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
let enrollmentResult

try {
const { skipFaceVerification, claimQueueAllowed } = conf
const { disableFaceVerification, claimQueueAllowed } = conf
const enrollmentProcessor = createEnrollmentProcessor(storage)

await enrollmentProcessor.validate(user, enrollmentIdentifier, payload)

// if user is already verified, we're skipping enroillment logic
if (user.isVerified || skipFaceVerification || isE2ERunning) {
if (user.isVerified || disableFaceVerification || isE2ERunning) {
// creating enrollment session manually for this user
const enrollmentSession = enrollmentProcessor.createEnrollmentSession(user, log)
// to access user's session reference in the Gun
Expand All @@ -94,8 +94,8 @@ const setup = (app: Router, verifier: VerificationAPI, storage: StorageAPI) => {
// he is no longer whitelisted there,
// so we trust that we already whitelisted him in the past
// and whitelist him again in the new contract
if (!skipFaceVerification) {
// checking for skipFaceVerification only
if (!disableFaceVerification) {
// checking for disableFaceVerification only
// because on automated tests runs user also should be whitelisted
try {
// in the session's lifecycle onEnrollmentCompleted() is called
Expand Down

0 comments on commit 1fda26d

Please sign in to comment.