Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions verify_email/app_configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ def __init__(self):
'verify_email/new_email_sent.html'
),

'verification_template': (
'VERIFICATION_TEMPLATE',
'verify_email/verification_template.html'
),


'salt': (
'HASH_SALT',
None
Expand Down
2 changes: 1 addition & 1 deletion verify_email/email_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __send_email(self, msg, useremail):
)

# Public :
def send_verification_link(self, request, inactive_user=None, form=None):
def send_verification_link(self, request, form=None):

if form:
inactive_user = form.save(commit=False)
Expand Down
33 changes: 33 additions & 0 deletions verify_email/templates/verify_email/verification_template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% extends "email_index.html" %}

{%block content%}

<div class="container"
style="
height: auto;
margin-bottom: 0px;
margin-top: 100px;
padding: 100px;
border: 0px solid red;
background-color: rgb(255, 255, 255);
border-radius: 20px;
box-shadow: rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;

">
<div class="container mt-5">
<h2 style="margin-bottom: 20px;">Click the button below to verify your email address</h2>
<hr>
<form method="POST">
{% csrf_token %}
<div style="margin-top: 50px;">
<button class="btn btn-outline-success" type="submit">Verify Email</button>
</div>
</form>

<div class="border-top pt-3 mt-3">
<small>Usually this template needs to be changed by your own app's template</small>
</div>
</div>
</div>

{% endblock %}
9 changes: 5 additions & 4 deletions verify_email/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
link_expired_template = pkg_configs.get('link_expired_template')
request_new_email_template = pkg_configs.get('request_new_email_template')
new_email_sent_template = pkg_configs.get('new_email_sent_template')

verify_template = pkg_configs.get('verification_template')

def verify_user_and_activate(request, useremail, usertoken):
"""
Expand All @@ -42,7 +42,7 @@ def verify_user_and_activate(request, useremail, usertoken):

verify the user's email and token and redirect'em accordingly.
"""
if request.method == 'GET':
if request.method == 'POST':
try:
verified = verify_user(useremail, usertoken)
if verified is True:
Expand Down Expand Up @@ -113,8 +113,9 @@ def verify_user_and_activate(request, useremail, usertoken):
)
except UserNotFound:
raise Http404("404 User not found")


else:
return render(request, template_name=verify_template)

def request_new_link(request, useremail=None, usertoken=None):
try:
if useremail is None or usertoken is None:
Expand Down