From 09d7e5af945ae047ab83ea7bcd261f36e95099b3 Mon Sep 17 00:00:00 2001 From: Ben Adida <ben@adida.net> Date: Thu, 13 Mar 2014 20:46:46 -0700 Subject: [PATCH] removed confusing characters from possible password characters --- helios/models.py | 2 +- helios/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helios/models.py b/helios/models.py index 8f92737..b1ce74d 100644 --- a/helios/models.py +++ b/helios/models.py @@ -925,7 +925,7 @@ class Voter(HeliosModel): if self.voter_password: raise Exception("password already exists") - self.voter_password = heliosutils.random_string(length) + self.voter_password = heliosutils.random_string(length, alphabet='abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ23456789') def store_vote(self, cast_vote): # only store the vote if it's cast later than the current one diff --git a/helios/utils.py b/helios/utils.py index 5bb805b..2db3dd7 100644 --- a/helios/utils.py +++ b/helios/utils.py @@ -119,9 +119,9 @@ def xss_strip_all_tags(s): random.seed() -def random_string(length=20): +def random_string(length=20, alphabet=None): random.seed() - ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' + ALPHABET = alphabet or 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' r_string = '' for i in range(length): r_string += random.choice(ALPHABET) -- GitLab