All I want to do is to set the username to be the same as the email address automatically in the backend inside the beforeSave. But if I do that inside my Cloud Code, email verification links become invalid and are not working anymore.
Is it possible to do it this way? Any hint would be great!
Best Nico
However, in your code you have set the email to be the username, which would probably explain why it break the email verification. If you want to set the username to equal the email address:
Question:
So it’s not possible to manipulate the mail adress in the before function, cause mail verification stuff will break then? Guess it should work, cause it’s BEFORE Save.
PLUS: The Rest API doesn’t accept a request for register a new User, if the username is missng… So we need to provide both (mail and username) from the frontend.
The idea is, that the user uses his/her mail adress (and a password) to login to my app and website. To exclude this “logic” from the frontend, I assumed I can handle it the way i did originally. ( Which works)
But now I want to implement mail verification and it broke, so I guess i need to change this.