User.getUidByEmail cannot find email?

Technical Support
  • Hello,

    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?

    Thanks,

    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.

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

    async.parallel([
    	async.apply(db.sortedSetAdd, 'email:uid', userData.uid, userData.email.toLowerCase()),
    	async.apply(db.sortedSetAdd, 'email:sorted', 0, userData.email.toLowerCase() + ':' + userData.uid),
    ], next);
    
  • @baris said in User.getUidByEmail cannot find email?:

    email:uid

    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?

    Thanks,

  • 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.

  • @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


  • 0 Votes
    1 Posts
    118 Views

    When user load avatar from imgur : error this operation is insecure

    on firefox you have this error :
    2021-01-15_08h56_42.png

    on chrome
    2021-01-15_09h32_55.png

    when user upload an image in a post or for avatar, there is this error
    2021-01-15_08h56_13.png

  • 0 Votes
    3 Posts
    422 Views

    @scottalanmiller is correct, those numbers are produced on the fly based on active websocket sessions, and not stored anywhere.

    However, you might be interested in https://github.com/barisusakli/nodebb-plugin-browsing-users, which brings a live-list of current users in-topic back to topic.tpl 😄

  • 0 Votes
    2 Posts
    379 Views

    Ah, not really... topic subscriptions are considered (in my opinion) user private data, and that is not shared by default.

    You could instruct your users to adjust their settings if they are being notified about a specific topic too often:

    36e3bb18-6c5d-422f-b160-32901d422107-image.png

  • How can i fix my user?

    Technical Support
    0 Votes
    1 Posts
    499 Views

    Hello... My user is one of the first to register on my forum (we have 2.6k now) and mine is to only one that the profile last posts and chat doesn't work.

    Does anyone have the same issue in the past? How you solve it?

    Its getting annoying... (i remember i tried to delete the user and create a new one logging in with facebook.... but it got the details of the old one.. so... everthing is fucked 🙂 )

  • 0 Votes
    7 Posts
    2k Views

    I'm not looking for a fully automated process, but a process that generates a list of spam users, where the admin can ban or delete these users with just one click.

    There are several ways to identify spam users.

    What I see is, that users register and either place a spam post directly or wait several days and then post spam.
    So in our forum a user with one post and negative reputation is a spammer with a 99.5% hit rate.

    I really would appreciate a plugin for that, or better a broader one, where based on user parameters different actions like 'ban' or 'delete' can be taken on admin' s decision. One admin could prefer 'ban' another one could prefer 'delete'.

    Also there could be different triggers for actions like 1 post and negative reputation
    registered long (= month or years) ago, but no post,....

    Unfortunately I'm pretty new to nodebb and not able to code a plugin myself.