Added verified icon for email

This commit is contained in:
ayxan 2022-12-07 22:01:05 +04:00
parent bb994fbe1f
commit 7708b7ccb1
3 changed files with 22 additions and 15 deletions

View File

@ -9,7 +9,13 @@
<div class="card mb-3"> <div class="card mb-3">
<div class="card-body"> <div class="card-body">
<h5>Username: <small>{{profile.username}}</small></h5> <h5>Username: <small>{{profile.username}}</small></h5>
<h5>Email: <small>{{profile.email|default:""}}</small></h5> {% if profile.email_notification_is_active %}
<h5>Email: <small style="margin-right: 0.7%;">{{profile.email|default:""}}</small>
<img src="{% static 'icons/verified.png' %}" alt="{% static 'icons/verified.png' %}" width="22px">
</h5>
{% else %}
<h5>Email: <small>{{profile.email|default:""}}</small></h5>
{% endif %}
<h5>IMDB API Key: <small>{{profile.imdb_api_key}}</small></h5> <h5>IMDB API Key: <small>{{profile.imdb_api_key}}</small></h5>
</div> </div>
</div> </div>

View File

@ -42,20 +42,21 @@ def profile_editing_view(request):
user.email_notification_is_active = False user.email_notification_is_active = False
user.save() user.save()
to_email = form.cleaned_data.get('email') to_email = form.cleaned_data.get('email')
current_site = get_current_site(request) if to_email is not None:
mail_subject = 'Activate your account.' current_site = get_current_site(request)
message = render_to_string('acc_active_email.html', { mail_subject = 'Activate your account.'
'user': user, message = render_to_string('acc_active_email.html', {
'domain': current_site.domain, 'user': user,
'uid': urlsafe_base64_encode(force_bytes(user.pk)), 'domain': current_site.domain,
'token': default_token_generator.make_token(user), 'uid': urlsafe_base64_encode(force_bytes(user.pk)),
}) 'token': default_token_generator.make_token(user),
email = EmailMessage( })
mail_subject, message, to=[to_email] email = EmailMessage(
) mail_subject, message, to=[to_email]
email.send() )
messages.warning(request, "Please confirm your email address to receive notifications of new episodes.") email.send()
return redirect('homepage') messages.warning(request, "Please confirm your email address to receive notifications of new episodes.")
return redirect('homepage')
messages.success(request, 'Profile Updated') messages.success(request, 'Profile Updated')
return redirect('homepage') return redirect('homepage')

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB