From 72f1e77f635472f04e094251e1842d288b1a8205 Mon Sep 17 00:00:00 2001 From: Wayne Lambert Date: Tue, 31 Aug 2021 17:09:25 +0100 Subject: [PATCH] Fix email token input Following using an integer field instead of a character field, a bug with the token input was introduced. Addresses the following: - Adds code to ensure the string of the token is 6 characters long by padding it with leading zeros. Contributes towards: #107 --- apps/users/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/users/views.py b/apps/users/views.py index 59e242ad..f1cdaf23 100644 --- a/apps/users/views.py +++ b/apps/users/views.py @@ -344,7 +344,7 @@ def populate_message(self, challenge_passes, token_within_expiry): def form_valid(self, form): super().form_valid(form) - token_returned = str(form.cleaned_data['token']) + token_returned = str(form.cleaned_data['token']).zfill(6) challenge_passes = self.does_challenge_pass(token_returned) email_token = self.get_email_token() if challenge_passes and email_token.is_challenge_within_expiry: