##// END OF EJS Templates
fixes #25 removed crypt based password hashing and changed it into sha1 based.
marcink -
r412:b6a25169 default
parent child Browse files
Show More
@@ -30,19 +30,18 b' from pylons_app.model import meta'
30 from pylons_app.model.db import User, RepoToPerm, Repository, Permission
30 from pylons_app.model.db import User, RepoToPerm, Repository, Permission
31 from sqlalchemy.exc import OperationalError
31 from sqlalchemy.exc import OperationalError
32 from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
32 from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
33 import crypt
33 import hashlib
34 from decorator import decorator
34 from decorator import decorator
35 import logging
35 import logging
36
36
37 log = logging.getLogger(__name__)
37 log = logging.getLogger(__name__)
38
38
39 def get_crypt_password(password):
39 def get_crypt_password(password):
40 """
40 """Cryptographic function used for password hashing based on sha1
41 Cryptographic function used for password hashing
42 @param password: password to hash
41 @param password: password to hash
43 """
42 """
44 return crypt.crypt(password, '6a')
43 hashed = hashlib.sha1(password).hexdigest()
45
44 return hashed[3:] + hashed[:3]
46
45
47 @cache_region('super_short_term', 'cached_user')
46 @cache_region('super_short_term', 'cached_user')
48 def get_user_cached(username):
47 def get_user_cached(username):
@@ -151,6 +150,8 b' def fill_perms(user):'
151
150
152 else:
151 else:
153 user.permissions['global'].add('repository.create')
152 user.permissions['global'].add('repository.create')
153 user.permissions['global'].add('hg.register')
154
154 for perm in default_perms:
155 for perm in default_perms:
155 if perm.Repository.private and not perm.Repository.user_id == user.user_id:
156 if perm.Repository.private and not perm.Repository.user_id == user.user_id:
156 #disable defaults for private repos,
157 #disable defaults for private repos,
General Comments 0
You need to be logged in to leave comments. Login now