diff --git a/app/__init__.py b/app/__init__.py
index 39264bf9a08a67abac3b8654600267013e92b7de..c0380e2a21e83bce8f13d113b0a084c177e4e15b 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -24,7 +24,7 @@ login_manager.login_message = LOGIN_MANAGER_MESSAGE
 
 
 def get_ldap_handler(env):
-    if env == "dev":
+    if env == "deeev":
         return DummyLdapAuthenticator()
     return DocLdapAuthenticator()
 
diff --git a/app/ldap_authentication/authenticator.py b/app/ldap_authentication/authenticator.py
index 5726f306ee9c726589ad27f6bdab59ce55ee3cb9..04a1b8f938de8db38cbd165d7761922f9687c1fb 100644
--- a/app/ldap_authentication/authenticator.py
+++ b/app/ldap_authentication/authenticator.py
@@ -9,7 +9,7 @@ from ldap.ldapobject import SimpleLDAPObject
 from app.protocols import Authenticator
 
 # Impersonation constants
-IMPERSONATION_OPERATOR = ".as."
+IMPERSONATION_PATTERN = r"([a-z0-9]+) as ([a-z0-9]+)"
 IMPERSONATORS = ["ac4014", "infosys", "ip914", "jsbailey", "ld507", "rbc"]
 
 
@@ -77,11 +77,13 @@ class DocLdapAuthenticator(Authenticator):
         :return: attr_name -> attr_value dict for given username
         """
         logging_in_as = username
-        if IMPERSONATION_OPERATOR in username:
-            users = username.split(IMPERSONATION_OPERATOR)
-            if users[0] in IMPERSONATORS:
-                username = users[0]
-                logging_in_as = users[1]
+        users = re.match(IMPERSONATION_PATTERN, username)
+        if users:
+            impersonator = users.groups()[0]
+            impersonated = users.groups()[1]
+            if impersonator in IMPERSONATORS:
+                username = impersonator
+                logging_in_as = impersonated
         connection = ldap.initialize(self.server_url)
         connection.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)
         connection.set_option(ldap.OPT_X_TLS_NEWCTX, 0)