-
Notifications
You must be signed in to change notification settings - Fork 953
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
[Do not merge] Basic registration #149
base: main
Are you sure you want to change the base?
Conversation
It looks like this is your first pull request. 🎉 Thank you for your contribution! One of the project maintainers will triage and assign the pull request for review. We appreciate your patience. To safeguard the health of the project, please take a moment to read our code of conduct. |
@wbamberg Looks great.
Your follow on question about how to pipe in email is much harder.
Both look a bit tedious. |
I like the first better than the second. A variant would be to include a link in the email for them to click, like how you do password reset. That would work, wouldn't it? In fact a lot of email verification seems like password reset, doesn't it? Create a magic token with an expiry, store it alongside the account, check it when the user provides it (e.g. as a URL parameter by clicking the link you sent them). If it checks out, mark the email as confirmed. (https://www.troyhunt.com/everything-you-ever-wanted-to-know/ is great on this, especially the flow chart) However, I think in the interests of getting something done I would like to hand-wave email verification for now (as we already handwave password reset). |
I think it's also time to talk about structure here. The difficulty really is that:
I feel though that this gives us a fairly chaotic structure, and forms is already a long and complicated chapter.
I think I'm fine to do (1), and more or less happy to do (3), but (2) sounds like a bigger task than I want to take on for this. WDYT? |
yes. I like it better because if you use some kind of explicit entry from the email there is no fetching required (easier to setup) and the approach might be reused for, say, an authenticator code. Yes in general to all, and yes we could handwave the email verification. There is nothing to stop us for demonstration purposes seeing the logged email and copying the provided link into the reset form (or however it is done) |
I think that 2 and 3 will be more or less the same amount of work, and more or less the same end result. In both cases you're trying to move forms before authentication and permissions, and in either case that will mean having form examples without permissions. The reason I prefer 3 in this case is that I think the examples are sensible for a library - coming up with new ones and a new challenge isn't IMO necessary or better. I also think you can reasonably say in the forms chapter "we'll look at the permissions aspects later" and tidy up the challenge appropriately. This will make the whole authentication topic more complicated though, because you'll have to backfill updates to how things work with forms. Other concerns are that authentication section currently follows sessions chapter because they build on each other - at least mentally, and otherwise the sessions topic feels like an orphan. So if doing this I would also move session ahead of forms too. I am not convinced that this organization is better than proposal "1". It would be nice to group all the authentication stuff together, and that is what is driving your thinking here. Others might argue that it is more important to group all the things to do with working with forms together. I'm not objective here - I see having a small section on signup form in "Forms" as a constrained job which logically groups forms stuff, and actually is quite nice in that it provides another good example of how you can build a model form and use permissions with it. Where this leaves us is that I won't know for sure until the final form of the example is decided. If the interactions that need to be documented for sign up end up being far more than "just a form"( as I describe above) then your option "3" makes more sense because we don't want to talk too much about authentication workflows in a forms topic. |
I think 2 is more work because we need to come up with new examples. As you know thinking of good examples is hard!
+1 definitely.
I don't think auth is a "thing to do with working with forms" though (in the way that say models, view, and templates are). Forms are more fundamental. Auth builds on and uses forms. Even the current auth chapter uses forms.
Then I think I should write up a PR based on (1) and we'll see what it looks like. My feeling is that it will be messy, hence my suggestion of (3). But hopefully we will get a clearer idea when it is in front of us. And this is your baby, so if you are happy with (1) so am I. |
That works for me. Or you can try for |
This is part of a fix for mdn/content#35484.
@hamishwillee suggested the way to address this was first to have updated tutorial code and then to have updated docs, which makes sense. However I think it might make sense to document this in two parts:
So this PR is to demo the first of these, which uses
UserCreationForm
directly. So this PR is not intended to be merged, it's just presented for feedback. I've tested it out and it seems to work fine. But I know almost nothing about Django.The second part would I think subclass
UserCreationForm
to capture an email address. (One piece missing that I don't know how to do, is that you are I think supposed to send and respond to a confirmation email, to make sure I guess that the new user has got the right email address.)