diff --git a/src/account/templates/profile_detail.html b/src/account/templates/profile_detail.html index c5bb529..4dc392a 100644 --- a/src/account/templates/profile_detail.html +++ b/src/account/templates/profile_detail.html @@ -9,7 +9,13 @@
Username: {{profile.username}}
-
Email: {{profile.email|default:""}}
+ {% if profile.email_notification_is_active %} +
Email: {{profile.email|default:""}} + {% static 'icons/verified.png' %} +
+ {% else %} +
Email: {{profile.email|default:""}}
+ {% endif %}
IMDB API Key: {{profile.imdb_api_key}}
diff --git a/src/account/views/profile_editing.py b/src/account/views/profile_editing.py index 1e4b94d..6b0c64a 100644 --- a/src/account/views/profile_editing.py +++ b/src/account/views/profile_editing.py @@ -42,20 +42,21 @@ def profile_editing_view(request): user.email_notification_is_active = False user.save() to_email = form.cleaned_data.get('email') - current_site = get_current_site(request) - mail_subject = 'Activate your account.' - message = render_to_string('acc_active_email.html', { - 'user': user, - 'domain': current_site.domain, - 'uid': urlsafe_base64_encode(force_bytes(user.pk)), - 'token': default_token_generator.make_token(user), - }) - email = EmailMessage( - mail_subject, message, to=[to_email] - ) - email.send() - messages.warning(request, "Please confirm your email address to receive notifications of new episodes.") - return redirect('homepage') + if to_email is not None: + current_site = get_current_site(request) + mail_subject = 'Activate your account.' + message = render_to_string('acc_active_email.html', { + 'user': user, + 'domain': current_site.domain, + 'uid': urlsafe_base64_encode(force_bytes(user.pk)), + 'token': default_token_generator.make_token(user), + }) + email = EmailMessage( + mail_subject, message, to=[to_email] + ) + email.send() + messages.warning(request, "Please confirm your email address to receive notifications of new episodes.") + return redirect('homepage') messages.success(request, 'Profile Updated') return redirect('homepage') diff --git a/src/static/icons/verified.png b/src/static/icons/verified.png new file mode 100644 index 0000000..c8438d8 Binary files /dev/null and b/src/static/icons/verified.png differ