diff --git a/verify_email/app_configurations.py b/verify_email/app_configurations.py index 5efa7b5..5823201 100644 --- a/verify_email/app_configurations.py +++ b/verify_email/app_configurations.py @@ -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 diff --git a/verify_email/email_handler.py b/verify_email/email_handler.py index b3fae6f..6416bbd 100644 --- a/verify_email/email_handler.py +++ b/verify_email/email_handler.py @@ -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) diff --git a/verify_email/templates/verify_email/verification_template.html b/verify_email/templates/verify_email/verification_template.html new file mode 100644 index 0000000..7396967 --- /dev/null +++ b/verify_email/templates/verify_email/verification_template.html @@ -0,0 +1,33 @@ +{% extends "email_index.html" %} + +{%block content%} + +
+
+

Click the button below to verify your email address

+
+
+ {% csrf_token %} +
+ +
+
+ +
+ Usually this template needs to be changed by your own app's template +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/verify_email/views.py b/verify_email/views.py index 07873db..ef9be69 100644 --- a/verify_email/views.py +++ b/verify_email/views.py @@ -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): """ @@ -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: @@ -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: