Description
Issue Description
When a user has verified their email, and then change it, the field emailVerified is still true.
Steps to reproduce
One user set their email. user.email = [email protected];
They clicks on the link to verify the email. user.emailVerified = true;
They changes their email. user.email = [email protected]; user.emailVerified = true;
Expected Results
I was expected emailVerified to become false again.
Environment Setup
- Server
- parse-server version 2.7.1
How to handle it
It might not be required by everyone, so I wanted to solve that issue inside the beforeSave
of Parse.User
, something like:
if (request.object.dirty('email') && !(request.original && request.original.get('email') === request.object.get('email'))) {
request.object.set('emailVerified', false)
}
Unfortunately, the user.emailVerified
field is protected, you need the masterKey to update that field. Maybe I have to call user.save({ emailVerified: false }, { useMasterKey: true })
inside user beforeSave but I don't like the idea (infinite loop). Maybe we could only require masterKey for setting emailVerified to true?
Thanks!