Closed
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
There are several issues if the Parse Server option verifyUserEmails
is set to a function and the email verification email is re-requested via the verificationEmailRequest
REST endpoint or via Parse.User.requestEmailVerification
:
- The Parse.User argument in
verifyUserEmails
is calleduser
, but in all other cases it is calledobject
. - The Parse.User argument in
verifyUserEmails
is a plain JS object, not aParse.User
object as in all other cases. - The IP address is not passed as argument.
- The installation ID is not passed as argument.
In addition, it cannot be determined whether the verifyUserEmails
is called due to a signup or login, or because the verification email is manually re-requested. Therefore it's not easily possible to limit the frequency with which a user can re-request verification emails.
Steps to reproduce
const user = new Parse.User();
user.setUsername('user');
user.setPassword('pass');
user.set('email', '[email protected]');
await user.signUp();
const verifyUserEmails = {
method: async (params) => {
expect(params.object).toBeInstanceOf(Parse.User);
expect(params.ip).toBeDefined();
expect(params.master).toBeDefined();
expect(params.installationId).toBeDefined();
expect(params.resendRequest).toBeTrue();
return true;
},
};
const verifyUserEmailsSpy = spyOn(verifyUserEmails, 'method').and.callThrough();
await reconfigureServer({
appName: 'test',
publicServerURL: 'http://localhost:1337/1',
verifyUserEmails: verifyUserEmails.method,
preventLoginWithUnverifiedEmail: verifyUserEmails.method,
preventSignupWithUnverifiedEmail: true,
emailAdapter: MockEmailAdapterWithOptions({
fromAddress: '[email protected]',
apiKey: 'k',
domain: 'd',
}),
});
await expectAsync(Parse.User.requestEmailVerification('[email protected]')).toBeResolved();
expect(verifyUserEmailsSpy).toHaveBeenCalledTimes(1);
Actual Outcome
Test fails.
Expected Outcome
Test should pass.
Environment
Server
- Parse Server version:
[7.0.0-alpha.4](https://github.com/parse-community/parse-server/releases/tag/7.0.0-alpha.4)