auth icon indicating copy to clipboard operation
auth copied to clipboard

Clarity on how `Fields.EmailHash` can be used to look up a user by their email address.

Open tadasajon opened this issue 4 years ago • 4 comments

Screen Shot 2021-12-22 at 4 50 46 PM

The value that I am passing in to this function is a normal email address, like "[email protected]" -- but then this plain email is used to try to find the user by their email_hash -- since I haven't hashed the email address, how is this supposed to work?

Instead of

|> Repo.get_by(email_hash: email)

I would expect

|> Repo.get_by(email: email)

but of course this won't work either because the email address is apparently encrypted...

So I guess I'd like clarity on what is going on behind the scenes such that this code is expected to work. Is there some black magic in the Fields library? If so, what is it?

Thanks!

tadasajon avatar Dec 22 '21 21:12 tadasajon

Screen Shot 2021-12-22 at 4 55 32 PM

tadasajon avatar Dec 22 '21 21:12 tadasajon

Added answer to this question to: https://github.com/dwyl/fields/pull/92 see: https://github.com/dwyl/fields/blob/43dd3ba8dfb8a209e30407580b6a1fc3d4ddbe61/README.md#questions

nelsonic avatar Dec 27 '21 23:12 nelsonic

The PR https://github.com/dwyl/fields/pull/92 is now merged.

SimonLab avatar Jan 28 '22 12:01 SimonLab

Hi @tadasajon hope you are well. I've attempted to answer your question in: https://github.com/dwyl/fields#questions ❓ Please let me know if that clarifies it. 🤞 Thanks. 👍

nelsonic avatar Feb 22 '22 10:02 nelsonic