dwyl / auth

🚪 🔐 UX-focussed Turnkey Authentication Solution for Web Apps/APIs (Documented, Tested & Maintained)
https://authdemo.fly.dev
GNU General Public License v2.0
135 stars 9 forks source link

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

Open tadasajon opened 2 years ago

tadasajon commented 2 years ago

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 "firstname.lastname@gmail.com" -- 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 commented 2 years ago

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

nelsonic commented 2 years ago

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

SimonLab commented 2 years ago

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

nelsonic commented 2 years ago

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