From f9ea7a4620f20f4fb0e5393752c1f73b3a194eaa Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 10 Apr 2023 22:34:38 -0400 Subject: [PATCH 01/10] if else fi not terminated with ; --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 19e38809a..d33e029b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -77,7 +77,7 @@ services: /usr/bin/mc anonymous set download minio_docker/$AWS_STORAGE_BUCKET_NAME; else echo 'MINIO_ACCESS_KEY, MINIO_SECRET_KEY, or MINIO_PORT are not defined. Skipping buckets creation.'; - fi + fi; exit 0; " From b02a81e1803fd27edda67ee026ac462d1ead4b6d Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 10 Apr 2023 22:37:12 -0400 Subject: [PATCH 02/10] password_reset --- src/apps/profiles/urls_accounts.py | 6 +++- src/apps/profiles/views.py | 28 +++++++++++++++++++ src/templates/base.html | 4 +++ .../registration/password_reset_complete.html | 10 +++++++ .../registration/password_reset_confirm.html | 14 ++++++++++ .../registration/password_reset_done.html | 18 ++++++++++++ .../registration/password_reset_email.html | 2 ++ .../registration/password_reset_form.html | 24 ++++++++++++++++ .../registration/registration_base.html | 1 + 9 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 src/templates/registration/password_reset_complete.html create mode 100644 src/templates/registration/password_reset_confirm.html create mode 100644 src/templates/registration/password_reset_done.html create mode 100644 src/templates/registration/password_reset_email.html create mode 100644 src/templates/registration/password_reset_form.html create mode 100644 src/templates/registration/registration_base.html diff --git a/src/apps/profiles/urls_accounts.py b/src/apps/profiles/urls_accounts.py index 6266d5216..fbc290f46 100644 --- a/src/apps/profiles/urls_accounts.py +++ b/src/apps/profiles/urls_accounts.py @@ -1,6 +1,6 @@ from django.conf.urls import url from django.urls import path - +from django.contrib.auth import views as auth_views from . import views app_name = "accounts" @@ -12,4 +12,8 @@ path('login/', views.LoginView.as_view(), name='login'), # path('logout/', auth_views.LogoutView.as_view(), name='logout'), path('logout/', views.LogoutView.as_view(), name='logout'), + path('password_reset/', views.CustomPasswordResetView.as_view(), name='password_reset'), + path('password_reset/done/', views.CustomPasswordResetDoneView.as_view(), name='password_reset_done'), + path('reset///', views.CustomPasswordResetConfirmView.as_view(), name='password_reset_confirm'), + path('reset/done/', views.CustomPasswordResetCompleteView.as_view(), name='password_reset_complete'), ] diff --git a/src/apps/profiles/views.py b/src/apps/profiles/views.py index 50e5cf66a..4cce77162 100644 --- a/src/apps/profiles/views.py +++ b/src/apps/profiles/views.py @@ -1,4 +1,5 @@ import json +import django from django.conf import settings from django.contrib import messages @@ -125,6 +126,33 @@ def sign_up(request): context['form'] = SignUpForm() return render(request, 'registration/signup.html', context) +# Password Reset views below +# https://devdocs.io/django~2.2/topics/auth/default#django.contrib.auth.views.PasswordChangeView +# Search for PasswordResetView +class CustomPasswordResetView(auth_views.PasswordResetView): + # form_class = auth_forms.PasswordResetForm + # template_name = 'registration/password_reset_form.html' + # email_template_name = '' # Defaults to registration/password_reset_email.html if not supplied. + # subject_template_name = '' # Defaults to registration/password_reset_subject.txt if not supplied. + # token_generator = '' # This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator. + success_url = django.urls.reverse_lazy("accounts:password_reset_done") + from_email = "codabench@codabench.org" + +class CustomPasswordResetDoneView(auth_views.PasswordResetDoneView): + pass + # template_name = '' # Defaults to registration/password_reset_done.html if not supplied. + +class CustomPasswordResetConfirmView(auth_views.PasswordResetConfirmView): + success_url = django.urls.reverse_lazy("accounts:password_reset_complete") + # template_name = '' # Default value is registration/password_reset_confirm.html. + # token_generator = '' # This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator. + # post_reset_login = '' # Defaults to False. + # form_class = '' # Defaults to django.contrib.auth.forms.SetPasswordForm. + # success_url = '' # Defaults to 'password_reset_complete' + +class CustomPasswordResetCompleteView(auth_views.PasswordResetCompleteView): + pass +# Password Reset views above class UserNotificationEdit(LoginRequiredMixin, DetailView): queryset = User.objects.all() diff --git a/src/templates/base.html b/src/templates/base.html index 127c812c8..5e96e8e1b 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -145,6 +145,10 @@ Notifications + + + Change Password + Logout diff --git a/src/templates/registration/password_reset_complete.html b/src/templates/registration/password_reset_complete.html new file mode 100644 index 000000000..e69a6e197 --- /dev/null +++ b/src/templates/registration/password_reset_complete.html @@ -0,0 +1,10 @@ +{% extends 'base.html' %} + +{% block content %} +
+

+ Password Reset Complete +

+

Your password has been successfully reset.

+
+{% endblock %} diff --git a/src/templates/registration/password_reset_confirm.html b/src/templates/registration/password_reset_confirm.html new file mode 100644 index 000000000..873f819bb --- /dev/null +++ b/src/templates/registration/password_reset_confirm.html @@ -0,0 +1,14 @@ +{% extends 'base.html' %} + +{% block content %} +
+

+ Change Password +

+
+ {% csrf_token %} + {{ form.as_p }} + +
+
+{% endblock %} diff --git a/src/templates/registration/password_reset_done.html b/src/templates/registration/password_reset_done.html new file mode 100644 index 000000000..c36f7c225 --- /dev/null +++ b/src/templates/registration/password_reset_done.html @@ -0,0 +1,18 @@ +{% extends "registration/registration_base.html" %} + +{% block title %}Password reset{% endblock %} + +{% block content %} +
+

+ Password Reset Complete +

+

+ We have sent you an email with a link to reset your password. Please check + your email and click the link to continue. +

+
+{% endblock %} + + +{# This is used by django.contrib.auth #} \ No newline at end of file diff --git a/src/templates/registration/password_reset_email.html b/src/templates/registration/password_reset_email.html new file mode 100644 index 000000000..249023bb2 --- /dev/null +++ b/src/templates/registration/password_reset_email.html @@ -0,0 +1,2 @@ +Someone asked for password reset for email {{ email }}. Follow the link below: +{{ protocol}}://{{ domain }}{% url 'accounts:password_reset_confirm' uidb64=uid token=token %} diff --git a/src/templates/registration/password_reset_form.html b/src/templates/registration/password_reset_form.html new file mode 100644 index 000000000..5d225765d --- /dev/null +++ b/src/templates/registration/password_reset_form.html @@ -0,0 +1,24 @@ +{% extends "registration/registration_base.html" %} + + +{% block title %}Reset password{% endblock %} + +{% block content %} +
+

+ Reset password +

+ {% if user.is_authenticated %} +

Note: you are already logged in as {{ user.username }}.

+ {% endif %} +

Forgot your password? Enter your email in the form below and we'll send you instructions for creating a new one.

+
+ {% csrf_token %} + {{ form.as_p }} + +
+
+{% endblock %} + + +{# This is used by django.contrib.auth #} \ No newline at end of file diff --git a/src/templates/registration/registration_base.html b/src/templates/registration/registration_base.html new file mode 100644 index 000000000..63913c188 --- /dev/null +++ b/src/templates/registration/registration_base.html @@ -0,0 +1 @@ +{% extends "base.html" %} \ No newline at end of file From d8b1c0dabcffda7c7791b9e7a9925454e06ee4cb Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 10 Apr 2023 22:39:40 -0400 Subject: [PATCH 03/10] forgot to add the forgot password link --- src/templates/registration/login.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/templates/registration/login.html b/src/templates/registration/login.html index 4ffd5fcb3..f4b802cb2 100644 --- a/src/templates/registration/login.html +++ b/src/templates/registration/login.html @@ -53,6 +53,7 @@

New to us? Sign Up

+

Forgot your password?

From 80a4feb37d98666a0336b504b30babc6ea9c7f20 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 10 Apr 2023 22:57:00 -0400 Subject: [PATCH 04/10] flask error --- src/apps/profiles/urls_accounts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/profiles/urls_accounts.py b/src/apps/profiles/urls_accounts.py index fbc290f46..e7f94ffb6 100644 --- a/src/apps/profiles/urls_accounts.py +++ b/src/apps/profiles/urls_accounts.py @@ -1,7 +1,7 @@ from django.conf.urls import url from django.urls import path -from django.contrib.auth import views as auth_views from . import views +# from django.contrib.auth import views as auth_views app_name = "accounts" From c8de3ae828566a1e5b05ea8abaf60881bd409109 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 10 Apr 2023 23:01:06 -0400 Subject: [PATCH 05/10] more flake errors --- src/apps/profiles/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/apps/profiles/views.py b/src/apps/profiles/views.py index 4cce77162..76782ba29 100644 --- a/src/apps/profiles/views.py +++ b/src/apps/profiles/views.py @@ -126,6 +126,7 @@ def sign_up(request): context['form'] = SignUpForm() return render(request, 'registration/signup.html', context) + # Password Reset views below # https://devdocs.io/django~2.2/topics/auth/default#django.contrib.auth.views.PasswordChangeView # Search for PasswordResetView @@ -138,10 +139,12 @@ class CustomPasswordResetView(auth_views.PasswordResetView): success_url = django.urls.reverse_lazy("accounts:password_reset_done") from_email = "codabench@codabench.org" + class CustomPasswordResetDoneView(auth_views.PasswordResetDoneView): pass # template_name = '' # Defaults to registration/password_reset_done.html if not supplied. + class CustomPasswordResetConfirmView(auth_views.PasswordResetConfirmView): success_url = django.urls.reverse_lazy("accounts:password_reset_complete") # template_name = '' # Default value is registration/password_reset_confirm.html. @@ -150,10 +153,12 @@ class CustomPasswordResetConfirmView(auth_views.PasswordResetConfirmView): # form_class = '' # Defaults to django.contrib.auth.forms.SetPasswordForm. # success_url = '' # Defaults to 'password_reset_complete' + class CustomPasswordResetCompleteView(auth_views.PasswordResetCompleteView): pass # Password Reset views above + class UserNotificationEdit(LoginRequiredMixin, DetailView): queryset = User.objects.all() template_name = 'profiles/user_notifications.html' From 953083b1384be265498a1724740b2e1625609ea3 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Tue, 11 Apr 2023 11:32:08 -0400 Subject: [PATCH 06/10] correct email --- src/apps/profiles/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/profiles/views.py b/src/apps/profiles/views.py index 76782ba29..16f6a6243 100644 --- a/src/apps/profiles/views.py +++ b/src/apps/profiles/views.py @@ -137,7 +137,7 @@ class CustomPasswordResetView(auth_views.PasswordResetView): # subject_template_name = '' # Defaults to registration/password_reset_subject.txt if not supplied. # token_generator = '' # This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator. success_url = django.urls.reverse_lazy("accounts:password_reset_done") - from_email = "codabench@codabench.org" + from_email = "info@codalab.org" class CustomPasswordResetDoneView(auth_views.PasswordResetDoneView): From 6e3d8e898d14c93c497144315c67311ae422dcec Mon Sep 17 00:00:00 2001 From: Benjamin Date: Thu, 13 Apr 2023 10:33:29 -0400 Subject: [PATCH 07/10] saving my place --- src/apps/profiles/views.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/apps/profiles/views.py b/src/apps/profiles/views.py index 16f6a6243..c91f80138 100644 --- a/src/apps/profiles/views.py +++ b/src/apps/profiles/views.py @@ -9,6 +9,7 @@ from django.http import Http404 from django.shortcuts import render, redirect from django.contrib.auth import views as auth_views +# from django.contrib.auth import forms as auth_forms ## from django.contrib.auth.mixins import LoginRequiredMixin from django.template.loader import render_to_string from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode @@ -130,10 +131,29 @@ def sign_up(request): # Password Reset views below # https://devdocs.io/django~2.2/topics/auth/default#django.contrib.auth.views.PasswordChangeView # Search for PasswordResetView + +# class PasswordResetForm(forms.Form): + + +# auth_forms class CustomPasswordResetView(auth_views.PasswordResetView): + # def get_context_data(self, *args, **kwargs): + # context = super(LoginView, self).get_context_data(*args, **kwargs) + # # "http://localhost:8888/profiles/signup?next=http://localhost/social/login/chahub" + # context['chahub_signup_url'] = "{}/profiles/signup?next={}/social/login/chahub".format(settings.SOCIAL_AUTH_CHAHUB_BASE_URL, settings.SITE_DOMAIN) + # return context + # import pdb; pdb.set_trace() + # def send_mail(self, subject_template_name, email_template_name, + # context, from_email, to_email, html_email_template_name=None): + # # Render the email message + # email_message = render_to_string(email_template_name, context) + + # # Print the email message to the console + # print(email_message) # form_class = auth_forms.PasswordResetForm # template_name = 'registration/password_reset_form.html' # email_template_name = '' # Defaults to registration/password_reset_email.html if not supplied. + print("CustomPasswordResetView") # subject_template_name = '' # Defaults to registration/password_reset_subject.txt if not supplied. # token_generator = '' # This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator. success_url = django.urls.reverse_lazy("accounts:password_reset_done") From 67e43958237ba380ba381b9ee157fc4f8bb66fc0 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Tue, 18 Apr 2023 11:49:34 -0400 Subject: [PATCH 08/10] print to django logs --- src/apps/profiles/urls_accounts.py | 9 ++- src/apps/profiles/views.py | 92 +++++++++++++++++++----------- 2 files changed, 66 insertions(+), 35 deletions(-) diff --git a/src/apps/profiles/urls_accounts.py b/src/apps/profiles/urls_accounts.py index e7f94ffb6..43d4411c3 100644 --- a/src/apps/profiles/urls_accounts.py +++ b/src/apps/profiles/urls_accounts.py @@ -1,7 +1,7 @@ from django.conf.urls import url from django.urls import path from . import views -# from django.contrib.auth import views as auth_views +from django.contrib.auth import views as auth_views app_name = "accounts" @@ -12,8 +12,11 @@ path('login/', views.LoginView.as_view(), name='login'), # path('logout/', auth_views.LogoutView.as_view(), name='logout'), path('logout/', views.LogoutView.as_view(), name='logout'), + path('password_reset/', views.CustomPasswordResetView.as_view(), name='password_reset'), - path('password_reset/done/', views.CustomPasswordResetDoneView.as_view(), name='password_reset_done'), + # path('password_reset/done/', views.CustomPasswordResetDoneView.as_view(), name='password_reset_done'), + path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'), path('reset///', views.CustomPasswordResetConfirmView.as_view(), name='password_reset_confirm'), - path('reset/done/', views.CustomPasswordResetCompleteView.as_view(), name='password_reset_complete'), + # path('reset/done/', views.CustomPasswordResetCompleteView.as_view(), name='password_reset_complete'), + path('reset/done/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'), ] diff --git a/src/apps/profiles/views.py b/src/apps/profiles/views.py index c91f80138..17d6e9565 100644 --- a/src/apps/profiles/views.py +++ b/src/apps/profiles/views.py @@ -5,11 +5,11 @@ from django.contrib import messages from django.contrib.auth import authenticate from django.contrib.sites.shortcuts import get_current_site -from django.core.mail import EmailMessage +from django.core.mail import EmailMessage, EmailMultiAlternatives from django.http import Http404 from django.shortcuts import render, redirect from django.contrib.auth import views as auth_views -# from django.contrib.auth import forms as auth_forms ## +from django.contrib.auth import forms as auth_forms from django.contrib.auth.mixins import LoginRequiredMixin from django.template.loader import render_to_string from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode @@ -128,55 +128,83 @@ def sign_up(request): return render(request, 'registration/signup.html', context) -# Password Reset views below -# https://devdocs.io/django~2.2/topics/auth/default#django.contrib.auth.views.PasswordChangeView -# Search for PasswordResetView - -# class PasswordResetForm(forms.Form): - - +# Password Reset views/forms below # auth_forms +class CustomPasswordResetForm(auth_forms.PasswordResetForm): + """ + Subclassed auth_forms.PasswordResetForm in order to add a print statement + to see the email in the logs. + Source: https://github.com/django/django/blob/8b1ff0da4b162e87edebd94e61f2cd153e9e159d/django/contrib/auth/forms.py#L287 + """ + def send_mail( + self, + subject_template_name, + email_template_name, + context, + from_email, + to_email, + html_email_template_name=None, + ): + """ + Send a django.core.mail.EmailMultiAlternatives to `to_email`. + """ + subject = render_to_string(subject_template_name, context) + # Email subject *must not* contain newlines + subject = "".join(subject.splitlines()) + body = render_to_string(email_template_name, context) + + email_message = EmailMultiAlternatives(subject, body, from_email, [to_email]) + print(email_message.message()) + if html_email_template_name is not None: + html_email = render_to_string(html_email_template_name, context) + email_message.attach_alternative(html_email, "text/html") + + email_message.send() + +# auth_views +# https://devdocs.io/django~2.2/topics/auth/default#django.contrib.auth.views.PasswordChangeView # Search for PasswordResetView class CustomPasswordResetView(auth_views.PasswordResetView): - # def get_context_data(self, *args, **kwargs): - # context = super(LoginView, self).get_context_data(*args, **kwargs) - # # "http://localhost:8888/profiles/signup?next=http://localhost/social/login/chahub" - # context['chahub_signup_url'] = "{}/profiles/signup?next={}/social/login/chahub".format(settings.SOCIAL_AUTH_CHAHUB_BASE_URL, settings.SITE_DOMAIN) - # return context - # import pdb; pdb.set_trace() - # def send_mail(self, subject_template_name, email_template_name, - # context, from_email, to_email, html_email_template_name=None): - # # Render the email message - # email_message = render_to_string(email_template_name, context) - - # # Print the email message to the console - # print(email_message) - # form_class = auth_forms.PasswordResetForm + """ + 1. form_class: subclassing auth_views.PasswordResetView to use a custom form "CustomPasswordResetForm" above + 2. success_url: Our src/apps/profiles/urls_accounts.py has become an "app" with the use of "app_name". + We have to use app:view_name syntax in templates like " {% url 'accounts:password_reset_confirm'%} " + Therefore we need to tell this view to find the right success_url with that syntax or django won't be + able to find the view. + 3. from_email: We want to set the from_email to info@codalab.org - may eventually put in .env file. + # The other commented sections are the defaults for other attributes in auth_views.PasswordResetView. + They are in here in case someone wants to customize in the future. All attributes show up in the order + shown in the docs. + """ # template_name = 'registration/password_reset_form.html' + form_class = CustomPasswordResetForm # auth_forms.PasswordResetForm # email_template_name = '' # Defaults to registration/password_reset_email.html if not supplied. - print("CustomPasswordResetView") # subject_template_name = '' # Defaults to registration/password_reset_subject.txt if not supplied. # token_generator = '' # This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator. success_url = django.urls.reverse_lazy("accounts:password_reset_done") from_email = "info@codalab.org" -class CustomPasswordResetDoneView(auth_views.PasswordResetDoneView): - pass +# class CustomPasswordResetDoneView(auth_views.PasswordResetDoneView): +# pass # template_name = '' # Defaults to registration/password_reset_done.html if not supplied. class CustomPasswordResetConfirmView(auth_views.PasswordResetConfirmView): - success_url = django.urls.reverse_lazy("accounts:password_reset_complete") + """ + 1. success_url: Our src/apps/profiles/urls_accounts.py has become an "app" with the use of "app_name". + We have to use app:view_name syntax in templates like " {% url 'accounts:password_reset_confirm'%} " + Therefore we need to tell this view to find the right success_url with that syntax or django won't be + able to find the view. + """ # template_name = '' # Default value is registration/password_reset_confirm.html. + # form_class = '' # Defaults to django.contrib.auth.forms.SetPasswordForm. # token_generator = '' # This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator. # post_reset_login = '' # Defaults to False. - # form_class = '' # Defaults to django.contrib.auth.forms.SetPasswordForm. - # success_url = '' # Defaults to 'password_reset_complete' + success_url = django.urls.reverse_lazy("accounts:password_reset_complete") -class CustomPasswordResetCompleteView(auth_views.PasswordResetCompleteView): - pass -# Password Reset views above +# class CustomPasswordResetCompleteView(auth_views.PasswordResetCompleteView): +# pass class UserNotificationEdit(LoginRequiredMixin, DetailView): From 8abc387af8c53b82fdb4ada50d26a7d9755d4291 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Tue, 18 Apr 2023 12:15:01 -0400 Subject: [PATCH 09/10] final design change --- src/apps/profiles/urls_accounts.py | 3 --- src/apps/profiles/views.py | 9 --------- 2 files changed, 12 deletions(-) diff --git a/src/apps/profiles/urls_accounts.py b/src/apps/profiles/urls_accounts.py index 43d4411c3..86321d24e 100644 --- a/src/apps/profiles/urls_accounts.py +++ b/src/apps/profiles/urls_accounts.py @@ -12,11 +12,8 @@ path('login/', views.LoginView.as_view(), name='login'), # path('logout/', auth_views.LogoutView.as_view(), name='logout'), path('logout/', views.LogoutView.as_view(), name='logout'), - path('password_reset/', views.CustomPasswordResetView.as_view(), name='password_reset'), - # path('password_reset/done/', views.CustomPasswordResetDoneView.as_view(), name='password_reset_done'), path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'), path('reset///', views.CustomPasswordResetConfirmView.as_view(), name='password_reset_confirm'), - # path('reset/done/', views.CustomPasswordResetCompleteView.as_view(), name='password_reset_complete'), path('reset/done/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'), ] diff --git a/src/apps/profiles/views.py b/src/apps/profiles/views.py index 17d6e9565..74f5884b3 100644 --- a/src/apps/profiles/views.py +++ b/src/apps/profiles/views.py @@ -184,11 +184,6 @@ class CustomPasswordResetView(auth_views.PasswordResetView): from_email = "info@codalab.org" -# class CustomPasswordResetDoneView(auth_views.PasswordResetDoneView): -# pass - # template_name = '' # Defaults to registration/password_reset_done.html if not supplied. - - class CustomPasswordResetConfirmView(auth_views.PasswordResetConfirmView): """ 1. success_url: Our src/apps/profiles/urls_accounts.py has become an "app" with the use of "app_name". @@ -203,10 +198,6 @@ class CustomPasswordResetConfirmView(auth_views.PasswordResetConfirmView): success_url = django.urls.reverse_lazy("accounts:password_reset_complete") -# class CustomPasswordResetCompleteView(auth_views.PasswordResetCompleteView): -# pass - - class UserNotificationEdit(LoginRequiredMixin, DetailView): queryset = User.objects.all() template_name = 'profiles/user_notifications.html' From 6dad0c42895a02d5ad0fbfda836a98bb6b8c38ec Mon Sep 17 00:00:00 2001 From: Benjamin Date: Tue, 18 Apr 2023 12:18:54 -0400 Subject: [PATCH 10/10] flake formatting errors --- src/apps/profiles/views.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/apps/profiles/views.py b/src/apps/profiles/views.py index 74f5884b3..fe02bdee9 100644 --- a/src/apps/profiles/views.py +++ b/src/apps/profiles/views.py @@ -160,7 +160,8 @@ def send_mail( email_message.attach_alternative(html_email, "text/html") email_message.send() - + + # auth_views # https://devdocs.io/django~2.2/topics/auth/default#django.contrib.auth.views.PasswordChangeView # Search for PasswordResetView class CustomPasswordResetView(auth_views.PasswordResetView): @@ -172,14 +173,14 @@ class CustomPasswordResetView(auth_views.PasswordResetView): able to find the view. 3. from_email: We want to set the from_email to info@codalab.org - may eventually put in .env file. # The other commented sections are the defaults for other attributes in auth_views.PasswordResetView. - They are in here in case someone wants to customize in the future. All attributes show up in the order + They are in here in case someone wants to customize in the future. All attributes show up in the order shown in the docs. """ # template_name = 'registration/password_reset_form.html' - form_class = CustomPasswordResetForm # auth_forms.PasswordResetForm - # email_template_name = '' # Defaults to registration/password_reset_email.html if not supplied. - # subject_template_name = '' # Defaults to registration/password_reset_subject.txt if not supplied. - # token_generator = '' # This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator. + form_class = CustomPasswordResetForm # auth_forms.PasswordResetForm + # email_template_name = '' # Defaults to registration/password_reset_email.html if not supplied. + # subject_template_name = '' # Defaults to registration/password_reset_subject.txt if not supplied. + # token_generator = '' # This will default to default_token_generator, it’s an instance of django.contrib.auth.tokens.PasswordResetTokenGenerator. success_url = django.urls.reverse_lazy("accounts:password_reset_done") from_email = "info@codalab.org"