parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

emailVerified issue during User update

Open medispanu opened this issue 9 years ago • 3 comments

Issue Description

When I update a User object, the field verifiedEmail is forced to false even though setted to false

Steps to reproduce

  • my configuration verifyUserEmails: true, emailVerifyTokenValidityDuration: 2 * 60 * 60, // in seconds (2 hours = 7200 seconds) preventLoginWithUnverifiedEmail: true,

-It's not present any configuration r function in cloud main.js file

  • Update a existing user with parse node library

                                 var query = new Parse.Query(Parse.User);
                                 query.equalTo("icareId", farmaUser.get('icareId'));
                                 query.find().then(utente => {
                                  utente = utente[0];
                                  console.log('  Farma user ' + utente.get('icareId') + ' is updating');
    
                                  utente.set("icareId", farmaUser.get('icareId'));
                                  utente.set("username", farmaUser.get('username'));
                                  utente.set("email", farmaUser.get("email"));
                                  utente.set("pharmacy", farmaUser.get('pharmacy'));
                                  utente.set("name", farmaUser.get('name'));
                                  utente.set("surname", farmaUser.get('surname'));
                                  utente.set("phone", farmaUser.get('phone'));
                                  utente.set("birthday", farmaUser.get('birthday'));
                                  utente.set("sex", farmaUser.get('sex'));
                                  utente.save();
    

Expected Results

The value of emailVerified field must remain to old value

Actual Outcome

The value of emailVerified field changes to false value and verification email is sent.

Environment Setup

  • Server

    • parse-server version 2.3.7 or 2.3.1
    • Operating System: Ubuntu
    • Hardware: Linux Server
    • Localhost
  • Database

    • MongoDB version: 2.4.9-1ubuntu2
    • Storage engine: MongoDB
    • Hardware: Linux Server
    • Localhost

Logs/Trace

Include all relevant logs. You can turn on additional logging by configuring VERBOSE=1 in your environment.

medispanu avatar Apr 04 '17 17:04 medispanu

Hi @medispanu ,

I'm experiencing the exact same issue! Everytime the user object will be re-saved. Even if the "email" field did NOT change, it triggers a ne emailVerification...

Do you know any solutions or short workarounds to this I could implement?

Thanks much for feedback and best regards, Christian

code-K avatar Apr 22 '17 13:04 code-K

@code-K @medispanu Having exact same issue for FB login. Did you find any solution?

junal avatar Sep 28 '17 15:09 junal

Hi Junal,

I verify the email before the save action: I check if the email is equal and, if it’s equal, I do unset to email field of my user object.

I hope I was useful.

Regards

Enrico Spanu

Medispa srl Via San Calimero 1 - Milano Viale Monastir 220 - Cagliari medispa.it my-icare.com +39.02.39624490

Le informazioni contenute nella presente comunicazione e i relativi allegati possono essere riservate e sono, comunque, destinate esclusivamente alle persone o alla Società sopraindicati. La diffusione, distribuzione e/o copiatura del documento trasmesso da parte di qualsiasi soggetto diverso dal destinatario è proibita, sia ai sensi dell’art. 616 c.p. , che ai sensi del D.Lgs. n. 196/2003 e successivi ravvedimenti. Se avete ricevuto questo messaggio per errore, vi preghiamo di distruggerlo e di informarci immediatamente per telefono allo 02.39624490 o inviando un messaggio all’indirizzo e-mail [email protected]

Sent from my iPhone

Il giorno 28 set 2017, alle ore 17:07, Junal Rahman [email protected] ha scritto:

@code-K @medispanu Having exact same issue for FB login. Did you find any solution?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

medispanu avatar Sep 28 '17 17:09 medispanu