• HOME
    • PRODUCT
    • PRICING
    • ABOUT
    • COMMUNITY
    Menu
    • HOME
    • PRODUCT
    • PRICING
    • ABOUT
    • COMMUNITY
    Get in touch
    Get in touch
    Menu
    • HOME
    • PRODUCT
    • PRICING
    • ABOUT
    • COMMUNITY
    • Sign in
    • Start free trial
    • Get in touch
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups
    • Documentation
      • Home
      • Read API
      • Write API
      • Plugin Development
    1. Home
    2. Nir S
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 11
    • Best 0
    • Controversial 0
    • Groups 0

    Nir S

    @Nir S

    0
    Reputation
    3
    Profile views
    11
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Nir S Unfollow Follow

    Latest posts made by Nir S

    • Hook + small code change request

      Hey,

      Not sure if that's the right category, but here goes.

      I want to implement a plugin which makes it so the email addresses of registered users are stored hashed for privacy reasons.

      I think I can use action:user.email.confirmed to overwrite the email with its hashed version.
      I want to still support password reset and to that end I want to use the hashed provided email to get the uid of the user.

      Would it be possible to add a hook for filtering the email provided to getUidByEmail here?

      Additionally, in order to use the non-hashed email as the address, it would also require passing the user provided email in params here.

      Wdyt?

      See here for more details.

      Thanks!

      posted in Feature Requests
      Nir S
      Nir S
    • RE: Storing only hashed email

      Thanks!

      I guess I can hook to action:user.email.confirmed for reading the existing email and then replacing it with a hashed version.

      However, password reset wouldn't work since it wouldn't find the uid for the (non hashed) email address provided (here).

      We can add a hook for preprocessing the email before looking for the uid, but that won't be enough since later the email is sent according to the email field in the db (i.e. not the email provided by the user when asking to reset).

      One possible solution is:

      1. Add a hook for preprocessing the email used for getting the uid.
      2. Pass the provided email in params to emailer.send (here) like it's done for welcome and email verification.
      3. And here instead of checking that for the template check if params.email is defined.

      Does that make sense?

      posted in Plugin Development
      Nir S
      Nir S
    • RE: Storing only hashed email

      @pitaj Yes, this is one downside of this approach.

      Users with unconfirmed email will not be able to post, so at least there won't be posts associated with the unhashed email, but this is not ideal.

      posted in Plugin Development
      Nir S
      Nir S
    • RE: Storing only hashed email

      @pitaj I was thinking to compare the hash of the provided email to the stored hashed emails in the db.

      posted in Plugin Development
      Nir S
      Nir S
    • Storing only hashed email

      Hey,

      For privacy reasons, I want to only store the hashed-salted version of a user's email (in favor of restoring the user's password for example).

      It seems one way to go about this is to hook to action:user.email.confirmed and there generate a salt, created hashed email, store hashed email and salt and remove the non-hashed email from the db.

      Then I would also need to also hook somewhere in the forgot email logic.
      This would also require disabling email editing for the user of course.

      The downsides of the above are:

      1. The email is kept in the db during confirmation stage.
      2. Its a bit wasteful to write the non hashed email and then delete it and write the hashed one.

      I'm new to NodeBB (and web development in general), and would appreciate any pointers.

      Thanks!

      posted in Plugin Development
      Nir S
      Nir S
    • RE: Custom email validation

      @baris @baris Thanks guys. It's working well.

      posted in Plugin Development
      Nir S
      Nir S
    • RE: Custom email validation

      @baris That was fast 🙂 Thanks!

      I'll check it out and update.

      posted in Plugin Development
      Nir S
      Nir S
    • RE: Custom email validation

      Actually even if I add an empty template, by the time the hook for checking the domain of the email triggers, the email interstitial would already update the non-validated email in the database and send a confirmation email ...

      Any suggestions?

      posted in Plugin Development
      Nir S
      Nir S
    • RE: Custom email validation

      @baris IIUC the function registered to filter:register.interstitial adds objects to data.interstitial with template, data and callback.

      It seems callback is optional, but template isn't.
      I tried using a callback to verify the email to throw an error when it fails, but looks like I have to specify a template (which I don't need).

      I guess I can try to add an empty template, but I'm wondering if there's a better way.

      posted in Plugin Development
      Nir S
      Nir S
    • RE: Custom email validation

      @baris Thanks for the quick response!

      Not in front of a computer right now, but AFAICT this plugin hooks to the filter:register.check which fires after username and password are provided, but before email is provided (which happens later via interstitials).
      Maybe things changed since it was written?

      What am I missing?

      posted in Plugin Development
      Nir S
      Nir S

    Get Started

    • Product
    • Pricing

    Resources

    • Demo Site
    • Answers
    • Docs
    • Bug Bounty

    Company

    • About
    • Blog
    • Contact
    Start Free Trial
    Github Facebook Instagram Twitter
    © 2014 – 2022 NodeBB, Inc. — Made in Canada.
    • Terms
    • Privacy
    • GDPR
    • DMCA
    • Contact
    Menu
    • Terms
    • Privacy
    • GDPR
    • DMCA
    • Contact