Skip to content
This repository has been archived by the owner on Oct 22, 2022. It is now read-only.

Commit

Permalink
Correct Token length and Auth config parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mazdakb committed Jun 14, 2018
1 parent 147dc5c commit 7434488
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class AuthTokenConfig(object):

def __init__(self):
for prop, value in getattr(settings, 'AUTH_TOKEN', {}).items():
setattr(self, f'token_{prop.lower()}', value)
setattr(self, f'TOKEN_{prop}', value)


class AuthTokenManager(models.Manager):
config = AuthTokenConfig()

def get_key(self, token):
return token[:int(self.config.TOKEN_CHARACTER_LENGTH)]
return token[:int(self.config.TOKEN_CHARACTER_LENGTH / 2)]

def hash_token(self, token, salt):
hash_object = SHA512.new()
Expand Down

0 comments on commit 7434488

Please sign in to comment.