Skip to content

Commit

Permalink
[FIX] Secret Registration not properly validating Invite Token (#17618)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-lehnen-rc committed May 14, 2020
1 parent 5bbf9c0 commit c9e5302
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions server/methods/registerUser.js
Expand Up @@ -39,12 +39,14 @@ Meteor.methods({
}

if (settings.get('Accounts_RegistrationForm') === 'Secret URL' && (!formData.secretURL || formData.secretURL !== settings.get('Accounts_RegistrationForm_SecretURL'))) {
if (formData.secretURL) {
try {
validateInviteToken(formData.secretURL);
} catch (e) {
throw new Meteor.Error('error-user-registration-secret', 'User registration is only allowed via Secret URL', { method: 'registerUser' });
}
if (!formData.secretURL) {
throw new Meteor.Error('error-user-registration-secret', 'User registration is only allowed via Secret URL', { method: 'registerUser' });
}

try {
validateInviteToken(formData.secretURL);
} catch (e) {
throw new Meteor.Error('error-user-registration-secret', 'User registration is only allowed via Secret URL', { method: 'registerUser' });
}
}

Expand Down

0 comments on commit c9e5302

Please sign in to comment.