Skip to content

Commit

Permalink
Fix email token input
Browse files Browse the repository at this point in the history
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
  • Loading branch information
WayneLambert committed Aug 31, 2021
1 parent 7d72b58 commit 72f1e77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 72f1e77

Please sign in to comment.