diff --git a/rhodecode/lib/middleware/simplehg.py b/rhodecode/lib/middleware/simplehg.py --- a/rhodecode/lib/middleware/simplehg.py +++ b/rhodecode/lib/middleware/simplehg.py @@ -35,7 +35,7 @@ from paste.auth.basic import AuthBasicAu from paste.httpheaders import REMOTE_USER, AUTH_TYPE from rhodecode.lib import safe_str -from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware +from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware, get_container_username from rhodecode.lib.utils import make_ui, invalidate_cache, \ is_valid_repo, ui_sections from rhodecode.model.db import User @@ -114,7 +114,7 @@ class SimpleHg(object): # NEED TO AUTHENTICATE AND ASK FOR AUTH USER PERMISSIONS #============================================================== - if not REMOTE_USER(environ): + if not get_container_username(environ, self.config): self.authenticate.realm = \ safe_str(self.config['rhodecode_realm']) result = self.authenticate(environ) @@ -130,8 +130,7 @@ class SimpleHg(object): #============================================================== if action in ['pull', 'push']: - #Removing realm from username - username = REMOTE_USER(environ).partition('@')[0] + username = get_container_username(environ, self.config) try: user = self.__get_user(username) if user is None: