diff --git a/web/pgadmin/authenticate/ldap.py b/web/pgadmin/authenticate/ldap.py
index 5aadda642..2f9e37576 100644
--- a/web/pgadmin/authenticate/ldap.py
+++ b/web/pgadmin/authenticate/ldap.py
@@ -28,9 +28,7 @@ except ImportError:
     from urlparse import urlparse
 
 
-ERROR_SEARCHING_LDAP_DIRECTORY = gettext(
-    "Error searching the LDAP directory: %s"
-)
+ERROR_SEARCHING_LDAP_DIRECTORY = "Error searching the LDAP directory: {}"
 
 
 class LDAPAuthentication(BaseAuthentication):
@@ -90,8 +88,8 @@ class LDAPAuthentication(BaseAuthentication):
                     ca_certs_file=ca_cert_file)
             except LDAPSSLConfigurationError as e:
                 current_app.logger.exception(
-                    "LDAP configuration error: %s\n" % e)
-                return False, "LDAP configuration error: %s\n" % e.args[0]
+                    "LDAP configuration error: {}\n".format(e))
+                return False, "LDAP configuration error: {}\n".format(e.args[0])
 
         try:
             # Create the server object
@@ -102,7 +100,7 @@ class LDAPAuthentication(BaseAuthentication):
                             tls=tls,
                             connect_timeout=config.LDAP_CONNECTION_TIMEOUT)
         except ValueError as e:
-            return False, "LDAP configuration error: %s." % e
+            return False, "LDAP configuration error: {}.".format(e)
 
         # Create the connection
         try:
@@ -118,18 +116,18 @@ class LDAPAuthentication(BaseAuthentication):
 
         except LDAPSocketOpenError as e:
             current_app.logger.exception(
-                "Error connecting to the LDAP server: %s\n" % e)
+                "Error connecting to the LDAP server: {}\n".format(e))
             return False, "Error connecting to the LDAP server:" \
-                          " %s\n" % e.args[0]
+                          " {}\n".format(e.args[0])
         except LDAPBindError as e:
             current_app.logger.exception(
                 "Error binding to the LDAP server.")
             return False, "Error binding to the LDAP server."
         except Exception as e:
             current_app.logger.exception(
-                "Error connecting to the LDAP server: %s\n" % e)
+                "Error connecting to the LDAP server: {}\n".format(e))
             return False, "Error connecting to the LDAP server:" \
-                          " %s\n" % e.args[0]
+                          " {}\n".format(e.args[0])
 
         # Enable TLS if STARTTLS is configured
         if not uri.scheme == 'ldaps' and config.LDAP_USE_STARTTLS:
@@ -137,8 +135,8 @@ class LDAPAuthentication(BaseAuthentication):
                 self.conn.start_tls()
             except LDAPStartTLSError as e:
                 current_app.logger.exception(
-                    "Error starting TLS: %s\n" % e)
-                return False, "Error starting TLS: %s\n" % e.args[0]
+                    "Error starting TLS: {}\n".format(e))
+                return False, "Error starting TLS: {}\n".format(e.args[0])
 
         return True, None
 
@@ -162,7 +160,10 @@ class LDAPAuthentication(BaseAuthentication):
         """Get a list of users from the LDAP server based on config
          search criteria."""
         try:
-            self.conn.search(search_base=config.LDAP_SEARCH_BASE_DN,
+            search_base_dn = config.LDAP_SEARCH_BASE_DN
+            if search_base_dn is None or search_base_dn == '':
+                search_base_dn = config.LDAP_BASE_DN
+            self.conn.search(search_base=search_base_dn,
                              search_filter=config.LDAP_SEARCH_FILTER,
                              search_scope=config.LDAP_SEARCH_SCOPE,
                              attributes=ALL_ATTRIBUTES
@@ -170,19 +171,19 @@ class LDAPAuthentication(BaseAuthentication):
 
         except LDAPInvalidScopeError as e:
             current_app.logger.exception(
-                gettext(ERROR_SEARCHING_LDAP_DIRECTORY) % e
+                ERROR_SEARCHING_LDAP_DIRECTORY.format(e.args[0])
             )
-            return False, gettext(ERROR_SEARCHING_LDAP_DIRECTORY) % e.args[0]
+            return False, ERROR_SEARCHING_LDAP_DIRECTORY.format(e.args[0])
         except LDAPAttributeError as e:
             current_app.logger.exception(
-                gettext(ERROR_SEARCHING_LDAP_DIRECTORY) % e
+                ERROR_SEARCHING_LDAP_DIRECTORY.format(e)
             )
-            return False, gettext(ERROR_SEARCHING_LDAP_DIRECTORY) % e.args[0]
+            return False, ERROR_SEARCHING_LDAP_DIRECTORY.format(e.args[0])
         except LDAPInvalidFilterError as e:
             current_app.logger.exception(
-                gettext(ERROR_SEARCHING_LDAP_DIRECTORY) % e
+                ERROR_SEARCHING_LDAP_DIRECTORY.format(e)
             )
-            return False, gettext(ERROR_SEARCHING_LDAP_DIRECTORY) % e.args[0]
+            return False, ERROR_SEARCHING_LDAP_DIRECTORY.format(e.args[0])
 
         for entry in self.conn.entries:
             user_email = None
@@ -191,4 +192,4 @@ class LDAPAuthentication(BaseAuthentication):
                 if 'mail' in entry:
                     user_email = entry['mail'].value
                 return True, user_email
-        return False, None
+        return False, ERROR_SEARCHING_LDAP_DIRECTORY.format("Could not find the specified user.")
diff --git a/web/pgadmin/utils/paths.py b/web/pgadmin/utils/paths.py
index dad5f0e41..462147cee 100644
--- a/web/pgadmin/utils/paths.py
+++ b/web/pgadmin/utils/paths.py
@@ -33,7 +33,7 @@ def get_storage_directory():
     if storage_dir is None:
         return None
 
-    username = current_user.email.split('@')[0]
+    username = current_user.username.split('@')[0]
     if len(username) == 0 or username[0].isdigit():
         username = 'pga_user_' + username
 
@@ -48,7 +48,7 @@ def get_storage_directory():
     storage_dir = os.path.join(
         storage_dir.decode('utf-8') if hasattr(storage_dir, 'decode')
         else storage_dir,
-        current_user.email.replace('@', '_')
+        current_user.username.replace('@', '_')
     )
 
     # Rename an old-style storage directory, if the new style doesn't exist
