From b6195f51d43d285a026cb079e2d8d809068f9b0c Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Thu, 1 Feb 2018 14:42:58 +0300 Subject: [PATCH 1/5] Fix reset password emal templates --- apps/auth/templates/auth/password_reset.html | 12 ++++++++++-- apps/auth/templates/auth/password_reset.txt | 2 ++ apps/auth/views.py | 5 ++--- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 apps/auth/templates/auth/password_reset.txt diff --git a/apps/auth/templates/auth/password_reset.html b/apps/auth/templates/auth/password_reset.html index 8af5626f..0467d253 100644 --- a/apps/auth/templates/auth/password_reset.html +++ b/apps/auth/templates/auth/password_reset.html @@ -1,2 +1,10 @@ -Someone asked for password reset for email {{ email }}. Follow the link below: -{{ protocol}}://{{ domain }}{% url 'lilcity:password_reset_confirm' uidb64=uid token=token %} \ No newline at end of file +{% extends "notification/email/_base.html" %} + +{% block content %} +

Для восстановления пароля нажмите кнопку ниже.

+
+ Нажмите для восстановления +

Или скопируйте ссылку ниже, и вставьте её в адресную строку браузера.

+

{{ protocol}}://{{ domain }}{% url 'lilcity:password_reset_confirm' uidb64=uid token=token %}

+
+{% endblock content %} diff --git a/apps/auth/templates/auth/password_reset.txt b/apps/auth/templates/auth/password_reset.txt new file mode 100644 index 00000000..dfd0f38b --- /dev/null +++ b/apps/auth/templates/auth/password_reset.txt @@ -0,0 +1,2 @@ +Восстановление пароля для {{ email }}. Перейдите по ссылке ниже: +{{ protocol}}://{{ domain }}{% url 'lilcity:password_reset_confirm' uidb64=uid token=token %} \ No newline at end of file diff --git a/apps/auth/views.py b/apps/auth/views.py index 0c0d248c..37bab7b3 100644 --- a/apps/auth/views.py +++ b/apps/auth/views.py @@ -94,13 +94,13 @@ class SuccessVerificationEmailView(TemplateView): class PasswordResetView(views.PasswordContextMixin, BaseFormView): - email_template_name = "auth/password_reset.html" + email_template_name = 'auth/password_reset.txt' subject_template_name = "auth/password_reset_subject.txt" form_class = views.PasswordResetForm extra_email_context = None from_email = None - html_email_template_name = None + html_email_template_name = "auth/password_reset.html" title = 'Password reset' token_generator = views.default_token_generator @@ -139,7 +139,6 @@ class FacebookLoginOrRegistration(View): return JsonResponse({"success": False}) fb_id = data.get('id') - print(fb_id) lilcity_user_settings = User.objects.filter(fb_id=fb_id) if lilcity_user_settings.count(): From a36abf376f86c90cddb7ead0996d2af79a0b3ebf Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Thu, 1 Feb 2018 15:39:28 +0300 Subject: [PATCH 2/5] Fix endif in password reset confirm simple template --- apps/auth/templates/auth/password_reset_confirm.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/auth/templates/auth/password_reset_confirm.html b/apps/auth/templates/auth/password_reset_confirm.html index 44d9d64f..ce2bfaba 100644 --- a/apps/auth/templates/auth/password_reset_confirm.html +++ b/apps/auth/templates/auth/password_reset_confirm.html @@ -9,4 +9,5 @@

The password reset link was invalid, possibly because it has already been used. Please request a new password reset. -

\ No newline at end of file +

+{% endif %} \ No newline at end of file From 0695730b515860938becad62f79ce19c91742098 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Thu, 1 Feb 2018 16:03:54 +0300 Subject: [PATCH 3/5] Add selected category to context --- apps/course/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/course/views.py b/apps/course/views.py index 8f5c7d14..2cf2b003 100644 --- a/apps/course/views.py +++ b/apps/course/views.py @@ -176,6 +176,12 @@ class CoursesView(ListView): filtered = CourseFilter(self.request.GET, queryset=queryset) return filtered.qs + def get_context_data(self): + context = super().get_context_data() + filtered = CourseFilter(self.request.GET) + context.update(filtered.data) + return context + def get_template_names(self): if self.request.is_ajax(): return 'course/course_items.html' From 3912aa88543fd913c9e28e48a362b974fe0b1398 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Thu, 1 Feb 2018 16:09:22 +0300 Subject: [PATCH 4/5] Fix tag conflict --- apps/course/templates/course/inclusion/category_items.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/course/templates/course/inclusion/category_items.html b/apps/course/templates/course/inclusion/category_items.html index 2d9adfd5..359b57ad 100644 --- a/apps/course/templates/course/inclusion/category_items.html +++ b/apps/course/templates/course/inclusion/category_items.html @@ -1,5 +1,5 @@ -{% for category in category_items %} -
-
{{ category.title }}
+{% for cat in category_items %} +
+
{{ cat.title }}
{% endfor %} \ No newline at end of file From 64ad02cb7141400699b49e6dd468eb12b8de95ec Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Thu, 1 Feb 2018 17:32:37 +0300 Subject: [PATCH 5/5] Update password reser confirm --- .../auth/password_reset_confirm.html | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/apps/auth/templates/auth/password_reset_confirm.html b/apps/auth/templates/auth/password_reset_confirm.html index ce2bfaba..4c61eece 100644 --- a/apps/auth/templates/auth/password_reset_confirm.html +++ b/apps/auth/templates/auth/password_reset_confirm.html @@ -1,13 +1,38 @@ +{% extends "templates/lilcity/index.html" %} +{% load static %} + +{% block content %} {% if validlink %} -

Change password

-
- {% csrf_token %} - {{ form.as_p }} - -
-{% else %} -

- The password reset link was invalid, possibly because it has already been used. - Please request a new password reset. -

-{% endif %} \ No newline at end of file +
+
+
+
Смена пароля
+
+
+
+
+
+
+ {% csrf_token %} +
+
Новый пароль
+
+ +
+
+
+
Повторите пароль
+
+ +
+
+ +
+ {% else %} +

+ The password reset link was invalid, possibly because it has already been used. Please request a new password reset. +

+ {% endif %} +
+
+{% endblock content %} \ No newline at end of file