User.getUidByEmail cannot find email?

Technical Support
  • #1


    I just had to do a mass update on the user objects in the DB, i updated all of the user emails to our new emails. When i look in the DB i can see that the email field has been updated correctly but the User.getUidByEmail in my AUTH plugin cannot find any of the new emails..

    User.getUidByEmail can however still see the old emails, is there another index somewhere that i need to update?


    UPDATE Incase it was case sensitive i updated all of the emails to uppercase and then forced the users email address to upper case in the login plugin. Still the same.. it can see the old emails but not the new.

  • NodeBB

    You have to update other objects in the database. Namely email:uid and email:sorted. These are created like this on user creation.

    	async.apply(db.sortedSetAdd, 'email:uid', userData.uid,,
    	async.apply(db.sortedSetAdd, 'email:sorted', 0, + ':' + userData.uid),
    ], next);
  • #3

    @baris said in User.getUidByEmail cannot find email?:


    Thanks @boris

    I saw these earlier but couldnt find a way that they were linked to the user object.. Is there a way to link them back now that i have already changed the email in the user object?

    Link them back as in find them based on some info in the user object so that i can update them?

    hmm.. looks like the email:uid object has a score equal to the user number in the _key field of the user object and the email:sorted has the value field ending in email:id (id that seems to equal the user number in the _key field of the user object. I guess thats how id link them?


  • NodeBB

    Yeah pretty much, email:uid sorted has the user id as the score and the lowercase email as the value.
    email:sorted has a score 0 and the value is useremail + ':' + userid It is used to search users by email.

  • #5

    @baris Yup this worked.. i was able to update everything.. I thought i was going crazy for a while earlier when it was still signing in with the old emails..

    Thanks again.

Suggested Topics

  • Reset Session For Specific User

    Unsolved Technical Support
    0 Votes
    7 Posts

  • 0 Votes
    7 Posts

  • 0 Votes
    1 Posts

  • 0 Votes
    7 Posts

  • 0 Votes
    2 Posts

| | | |