Browse files

Limit api keys to 38 characters.

  • Loading branch information...
1 parent f292169 commit 6459c4b761016001d28c22de195a5f5104148e2b @avidal committed Apr 11, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 wotmad/accounts/models.py
View
5 wotmad/accounts/models.py
@@ -34,9 +34,12 @@ def generate_key(cls):
# the special characters
key = base64.b64encode(key, pair)
- # Finally, strip off the trailing == if it exists
+ # Strip off the trailing == if it exists
key = key.rstrip('==')
+ # Reduce it down to 38 characters
+ key = key[:38]
+
# If this key has been taken already, then try again
if cls.objects.filter(key=key).count():
return cls.generate_key()

0 comments on commit 6459c4b

Please sign in to comment.