feat: Add new Parse Server option preventSignupWithUnverifiedEmail to prevent returning a user without session token on sign-up with unverified email address (#8451)
This commit is contained in:
@@ -160,6 +160,9 @@ RestWrite.prototype.execute = function () {
|
||||
this.response.response.authDataResponse = this.authDataResponse;
|
||||
}
|
||||
}
|
||||
if (this.storage.rejectSignup && this.config.preventSignupWithUnverifiedEmail) {
|
||||
throw new Parse.Error(Parse.Error.EMAIL_NOT_FOUND, 'User email is not verified.');
|
||||
}
|
||||
return this.response;
|
||||
});
|
||||
};
|
||||
@@ -879,7 +882,8 @@ RestWrite.prototype.createSessionTokenIfNeeded = function () {
|
||||
this.config.verifyUserEmails
|
||||
) {
|
||||
// verification is on
|
||||
return; // do not create the session token in that case!
|
||||
this.storage.rejectSignup = true;
|
||||
return;
|
||||
}
|
||||
return this.createSessionToken();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user