Show More
@@ -46,10 +46,10 b' except ImportError:' | |||
|
46 | 46 | __url__ = 'http://rhodecode.org' |
|
47 | 47 | |
|
48 | 48 | PLATFORM_WIN = ('Windows') |
|
49 | PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD', 'OpenBSD', 'SunOS') | |
|
49 | PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD', 'OpenBSD', 'SunOS') #depracated | |
|
50 | 50 | |
|
51 | 51 | is_windows = __platform__ in PLATFORM_WIN |
|
52 | is_unix = __platform__ in PLATFORM_OTHERS | |
|
52 | is_unix = not is_windows | |
|
53 | 53 | |
|
54 | 54 | |
|
55 | 55 | BACKENDS = { |
@@ -35,7 +35,7 b' from pylons import config, url, request' | |||
|
35 | 35 | from pylons.controllers.util import abort, redirect |
|
36 | 36 | from pylons.i18n.translation import _ |
|
37 | 37 | |
|
38 |
from rhodecode import __platform__, |
|
|
38 | from rhodecode import __platform__, is_windows, is_unix | |
|
39 | 39 | from rhodecode.model.meta import Session |
|
40 | 40 | |
|
41 | 41 | from rhodecode.lib.utils2 import str2bool, safe_unicode |
@@ -92,10 +92,10 b' class RhodeCodeCrypto(object):' | |||
|
92 | 92 | |
|
93 | 93 | :param password: password to hash |
|
94 | 94 | """ |
|
95 | if __platform__ in PLATFORM_WIN: | |
|
95 | if is_windows: | |
|
96 | 96 | from hashlib import sha256 |
|
97 | 97 | return sha256(str_).hexdigest() |
|
98 | elif __platform__ in PLATFORM_OTHERS: | |
|
98 | elif is_unix: | |
|
99 | 99 | import bcrypt |
|
100 | 100 | return bcrypt.hashpw(str_, bcrypt.gensalt(10)) |
|
101 | 101 | else: |
@@ -112,10 +112,10 b' class RhodeCodeCrypto(object):' | |||
|
112 | 112 | :param hashed: password in hashed form |
|
113 | 113 | """ |
|
114 | 114 | |
|
115 | if __platform__ in PLATFORM_WIN: | |
|
115 | if is_windows: | |
|
116 | 116 | from hashlib import sha256 |
|
117 | 117 | return sha256(password).hexdigest() == hashed |
|
118 | elif __platform__ in PLATFORM_OTHERS: | |
|
118 | elif is_unix: | |
|
119 | 119 | import bcrypt |
|
120 | 120 | return bcrypt.hashpw(password, hashed) == hashed |
|
121 | 121 | else: |
@@ -235,7 +235,7 b' def authenticate(username, password):' | |||
|
235 | 235 | user_attrs): |
|
236 | 236 | log.info('created new ldap user %s' % username) |
|
237 | 237 | |
|
238 | Session.commit() | |
|
238 | Session().commit() | |
|
239 | 239 | return True |
|
240 | 240 | except (LdapUsernameError, LdapPasswordError,): |
|
241 | 241 | pass |
@@ -262,7 +262,7 b' def login_container_auth(username):' | |||
|
262 | 262 | return None |
|
263 | 263 | |
|
264 | 264 | user.update_lastlogin() |
|
265 | Session.commit() | |
|
265 | Session().commit() | |
|
266 | 266 | |
|
267 | 267 | log.debug('User %s is now logged in by container authentication', |
|
268 | 268 | user.username) |
@@ -768,7 +768,7 b' class HasReposGroupPermissionAny(PermsFu' | |||
|
768 | 768 | class HasReposGroupPermissionAll(PermsFunction): |
|
769 | 769 | def __call__(self, group_name=None, check_Location=''): |
|
770 | 770 | self.group_name = group_name |
|
771 |
return super(HasReposGroupPermissionA |
|
|
771 | return super(HasReposGroupPermissionAll, self).__call__(check_Location) | |
|
772 | 772 | |
|
773 | 773 | def check_permissions(self): |
|
774 | 774 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now