Idea to allow different actor types registered with same email and unique password per actor type #13287
Muhd-Mairaj
started this conversation in
RFC
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Lets picture the scenario of a markeplace, as in the Restaurant-Delivery Example.
If I want to have separate applications for the driver/restaurantAdmin and the customer, and perhaps a separate dashboard for the admin. The current emailpass auth provider would have a strange flow for the users of the app. For example, a customer wants to register as a driver on the driver app, when registering an error message is displayed saying that their email is already being used and they should log in instead. As an end user, thats a bit strange.
I have an idea to enhance the emailpass provider to allow registration of one email with different password per account type. I would like feedback on the feasability and effectiveness of this approach.
Currently, it can be seen by analysing the
provider_identity
table that the (hashed) password is stored as a key-value pair in the provider_metadata field:"password": "secret"
. The idea is to change this to instead store the password in this format:for example, this would look like this:
The
register
method of the provider can then be modified to analyse the provider_metadata before concluding that the account is already registered. Similarly, the authenticate method (to login) and update method (to reset password) can be modified to handle this updated metadata. For the update method, the payload for theauth.password_reset
event already contains theactor_type
and can be included in the reset password link sent to the user.I would like to hear opinions on this approach
Beta Was this translation helpful? Give feedback.
All reactions