-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thoughts about an "accounts registration" plugin #1973
Comments
A couple of notes
Alternative proposalRegistrationRather than creating new resources to manage the registration, I would be ok to actually add a
We can have a settings to activate email validation, that will enforce email as usernames. When we do a POST on
With the To activate an account we would use:
It is the current procedure to change a password, that would activate the account by authenticating with the generated link and providing a new password. When an account is deactivated, the only endpoint allowed with the activation_key would be the change password endpoint. Reset passwordFor the reset password phase, we could use the We could still use: This would means that for this given endpoint we would accept the reset key from the cache as an alternative password to allow a user to change their password. |
I like the idea of extending the accounts plugin with email/registration features. It would require pyramid_mailer (or Kinto emailer?) to be installed though. The field I think that using the cache backend for activation/reset tokens would work. If users take too much time to activate the account, and they must revisit the activation/reset endpoint.. |
I was wondering about this: it means there's no way to ask for a username AND password on account creation, which is a somewhat widespread use case. A remaining question is: how do we deal with the email? If we want a simple link, then we need to validate the account using a simple GET (which means not providing a new password, which means using the alternate method using a We could also imagine having an optional |
Fair point.
This is actually a feature, I don't think one should link to the validation link on the kinto service directly, because you want to present some kind of UI to the user. Instead the GET link should link to the APP that will make the POST to the validation endpoint. My understanding is that we might want to ask for the password at this stage as well, so that one could use the same UI for changing the password, resetting the password and setting the first password. |
How about that: when the "account validation" option is enabled, it requires an extra To activate the user, this activation key needs to be Eg: {"data": {
"password": "azerty123",
"activation-form-url": "https://example.com/validate/123456789abc"
}} 3/ an email is sent with the link https://example.com/validate/123456789abc, following it leads to a custom form that will POST the activation key to kinto {"data": {
"password": "azerty123"
}} How does that sound? It does feel a bit brittle and bespoke, not sure that API makes sense... Other paths to explore:
|
I just realized: @Natim we can't use the password as the activation key, as it's stored hashed in the record, not in plain text. |
I don't see why it is a problem, because you can hash the one provided to validate it as we currently do with the password. |
How do you pass the activation key (the password) to the user (to the custom validation form)? |
You generate a key, you hash it you store it hashed in the database, you return it, the user uses it, you hash it then you validate it with the stored hashed one. |
and if the user loses the mail or whatever, there's no way to recreate the link? What happens then, the username is "lost" to everybody? |
If the email is lost you can recreate an account and get an new activation key. If you used the activation key you can use the reset password mechanism to change it again. If you loose the username, well it depends, what that means but I guess you can still create a new account and ask an admin to give you privileges. |
Implementation question: is there a way to specify a different resource schema given the settings? |
Yes there must be way with colander defer, or pyramid views scanning.. I wouldn't bother with that for now ;) |
I've started a WIP in https://github.com/Kinto/kinto/compare/master...magopian:1973-account-validation?expand=1
@leplatrem I believe kinto emailer wouldn't work here out of the box because it's missing: So either I can update the kinto-emailer plugin to add those modifications, or use the pyramid_mailer. Thoughts? |
I think it is fine not relying on kinto-emailer for that especially because kinto-emailer is a kinto plugin with a focus on notifications regarding resource updates. +1 to use pyramid_mailer directly. |
+1 to use pyramid_mailer directly. |
Following some discussions, here's my rough thoughts on creating an "accounts registration" plugin. The use case is having a flow for users to
1/ register an account
2/ receive a "registration code" via email
2/ validate their email using this "registration code"
3/ reset their password if needed
Register an account
1/ anonymous POST on
/accountsmgmt/register/<email>
2/ this creates a record
{"id": email, "password": hash, "registration-code": uuid}
3/ an email is sent with a link to
/accountsmgmt/register/validate/<registration-code>
4/ GETing
/accountsmgmt/register/validate/<registration-code>
returns the ID which is the username (the email)5/ POSTing to
/accountsmgmt/register/validate/<registration-code>
creates a kinto account with the same id and password, and updates the current "register" record to mark it as used (or deletes it)Resetting a password
1/ anonymous POST on
acountsmgmt/resetpassword/<email>
2/ this creates a record
{"id": email, "reset-code": uuid}
3/ an email is sent with a link to
/accountsmgmt/resetpassword/reset/<reset-code>
4/ GETing
/accountsmgmt/resetpassword/<reset-code>
returns the ID which is the username (the email)5/ POSTing the new password to
/accountsmgmt/resetpassword/reset/<reset-code>
updates the kinto account with the same ID, and updates the current "register" record to mark it as used (or deletes it)Using the email (username) as the ID as the advantage of not having several registration or password reset codes laying around for the same user. The drawback is that we're not benefiting from the "kinto resource" management as we're GET/POST-ing on endpoints that are the registration or password reset codes, and not the IDs.
Not sure if that makes sense? Do you have any feedback, ideas or tips?
The text was updated successfully, but these errors were encountered: