From 4556a355a29a30ba634e9468245c559c5754e2c5 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 15 Sep 2013 11:46:46 -0500 Subject: [PATCH] fixed a problem with CRYPT password length --- VERSION | 2 +- gluon/validators.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index bf445cbb..f7b70e31 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.2-stable+timestamp.2013.09.15.09.39.16 +Version 2.6.2-stable+timestamp.2013.09.15.11.45.56 diff --git a/gluon/validators.py b/gluon/validators.py index d7a0712e..3ad0c23e 100644 --- a/gluon/validators.py +++ b/gluon/validators.py @@ -2899,13 +2899,15 @@ class CRYPT(object): The actual hash algorithm is determined from the key which is generated by web2py in tools.py. This defaults to hmac+sha512. """ - self.key = key and key[:max_length] + self.key = key self.digest_alg = digest_alg self.min_length = min_length + self.max_length = max_length self.error_message = error_message self.salt = salt def __call__(self, value): + value = value and value[:self.max_length] if len(value) < self.min_length: return ('', translate(self.error_message)) return (LazyCrypt(self, value), None)