diff --git a/apps/user/templates/user/notification-settings.html b/apps/user/templates/user/notification-settings.html index fee35ff5..e15996e5 100644 --- a/apps/user/templates/user/notification-settings.html +++ b/apps/user/templates/user/notification-settings.html @@ -8,26 +8,20 @@ +{% if not user.is_email_proved %}
Подтверждение почты
На электронный адрес - sasha@lil.city отправлено письмо с кодом подтверждения. Введите код, чтобы подтвердить почту.
-
-
-
- -
-
- -
-
- Если у вас нет кода или письмо где-то затерялось, вы можете получить новый код подтверждения. Отправить новый код? + {{ user.email }} отправлено письмо для подтверждения.
+
Если письмо где-то затерялось, вы можете повторить отправку письма для подтверждения. Отправить?
+ ОТПРАВИТЬ
+{% endif %}
diff --git a/apps/user/templates/user/payment-history.html b/apps/user/templates/user/payment-history.html index fcf26606..db07ca8a 100644 --- a/apps/user/templates/user/payment-history.html +++ b/apps/user/templates/user/payment-history.html @@ -1,14 +1,28 @@ {% extends "templates/lilcity/index.html" %} {% load static %} {% block content %}
-
- +{% if not user.is_email_proved %} +
+
+
+
Подтверждение почты
+
На электронный адрес + {{ user.email }} отправлено письмо для подтверждения.
+
Если письмо где-то затерялось, вы можете повторить отправку письма для подтверждения. Отправить?
+ ОТПРАВИТЬ
-
+
+{% endif %} +
Вывести деньги со счета
@@ -28,7 +42,7 @@
- +
@@ -66,4 +80,4 @@
-{% endblock content %} +{% endblock content %} \ No newline at end of file diff --git a/apps/user/templates/user/profile-settings.html b/apps/user/templates/user/profile-settings.html index ce6e1842..9442e0a8 100644 --- a/apps/user/templates/user/profile-settings.html +++ b/apps/user/templates/user/profile-settings.html @@ -8,26 +8,20 @@
-{% comment %} - -{% endcomment %} +
+{% endif %} {% if messages %}
diff --git a/apps/user/views.py b/apps/user/views.py index 4de9a29a..fe977a57 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -2,22 +2,34 @@ from io import BytesIO from PIL import Image from os.path import splitext from django.contrib.auth import login -from django.shortcuts import render, reverse +from django.shortcuts import render, reverse, redirect from django.views.generic import DetailView, UpdateView, TemplateView from django.contrib import messages from django.contrib.auth import get_user_model from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.hashers import check_password, make_password from django.http import Http404 +from django.urls import reverse_lazy from django.utils.decorators import method_decorator +from apps.auth.tokens import verification_email_token from apps.course.models import Course +from apps.notification.utils import send_email from .forms import UserEditForm User = get_user_model() +@login_required +def resend_email_verify(request): + token = verification_email_token.make_token(request.user) + url = request.scheme + '://' + request.get_host() + str(reverse_lazy('lilcity:verification-email', args=[token])) + send_email('Verification Email', request.user.email, "notification/email/verification_email.html", url=url) + messages.info(request, 'Письмо подтверждения отправлено.') + return redirect('user-edit-profile', request.user.id) + + class UserView(DetailView): model = User template_name = 'user/profile.html' diff --git a/project/urls.py b/project/urls.py index 90fa3814..4b426d97 100644 --- a/project/urls.py +++ b/project/urls.py @@ -24,7 +24,7 @@ from apps.course.views import ( lessoncomment, CourseEditView, ) from apps.course.models import Course -from apps.user.views import UserView, UserEditView, NotificationEditView, PaymentHistoryView +from apps.user.views import UserView, UserEditView, NotificationEditView, PaymentHistoryView, resend_email_verify urlpatterns = [ path('admin/', admin.site.urls), @@ -43,6 +43,7 @@ urlpatterns = [ path('user//edit', UserEditView.as_view(), name='user-edit-profile'), path('user//notifications', NotificationEditView.as_view(), name='user-edit-notifications'), path('user//payments', PaymentHistoryView.as_view(), name='user-edit-payments'), + path('user/resend-email-verify', resend_email_verify, name='resend-email-verify'), path('privacy', TemplateView.as_view(template_name="templates/lilcity/privacy_policy.html"), name='privacy'), path('terms', TemplateView.as_view(template_name="templates/lilcity/terms.html"), name='terms'), path('refund-policy', TemplateView.as_view(template_name="templates/lilcity/refund_policy.html"), name='refund_policy'),