-
Notifications
You must be signed in to change notification settings - Fork 40
Description
When a person "registers," they get no feedback, but are just tossed back onto home page with no evidence of success.
Instead, could they be rewarded with a message that says something like: "Thanks for starting to register an account on our website. To complete your registration, please check your email for an message from us. You should have just received one. Please look in your spam / junk folder if our message is not in your inbox.
Also,
Please revise the message they get in that email so that it says something like: "Thanks for beginning your registration process on the Western Friend website. To complete your registration, click on the link below. If the link doesn't respond, please cut an paste it into your browser, then hit your return key.
Task
- update registration page to use the Django messages framework to display the following message directly on the website after the user submits the registration form
- "Thanks for starting to register an account on our website. To complete your registration, please check your email for an message from us. You should have just received one. Please look in your spam / junk folder if our message is not in your inbox."
- update the registration confirmation email template to include the following text:
- "Thanks for beginning your registration process on the Western Friend website. To complete your registration, click on the link below. If the link doesn't respond, please cut an paste it into your browser, then hit your return key."
Resources
This project is already configured to use and correctly messages from the Django messages framework. So, we should only need a small change to trigger the message, as described in the Django messages documentation.
check_email_message = "Thanks for starting to register an account on our website. To complete your registration, please check your email for an message from us. You should have just received one. Please look in your spam / junk folder if our message is not in your inbox"
messages.info(request, check_email_message)
The message should be added within a callback of our CustomRegistrationView
such as the form_valid
handler which redirects to the main page:
westernfriend.org/accounts/views.py
Lines 12 to 23 in a138f1b
class CustomRegistrationView(RegistrationView): | |
form_class = CustomUserForm | |
success_url = "/" | |
template_name = "django_registration/registration_form.html" | |
def get_context_data(self, **kwargs: Any) -> dict[str, Any]: | |
"""Add honeypot field to context.""" | |
context = super().get_context_data(**kwargs) | |
context["honeypot_field_name"] = settings.HONEYPOT_FIELD_NAME | |
return context |
The above code could be extended with the following form_valid
method:
def form_valid(self, form):
check_email_message = "Thanks for starting to register an account on our website. To complete your registration, please check your email for an message from us. You should have just received one. Please look in your spam / junk folder if our message is not in your inbox"
# notice we use `self.request` here since the request is a member of the CustomRegistrationView instance
messages.info(self.request, check_email_message)
return super().form_valid(form)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status