diff --git a/openbis/dist/server/service.properties b/openbis/dist/server/service.properties
index d91f3ab5cc4f964d592e147b616012b3aa12c161..6867b35e8732e4492b9d9b8ddef4dece3ae6846e 100644
--- a/openbis/dist/server/service.properties
+++ b/openbis/dist/server/service.properties
@@ -60,6 +60,8 @@ ldap.attributenames.email =
 ldap.attributenames.first.name =
 # The attribute name for the last name, defaults to "sn"
 ldap.attributenames.last.name =
+# Set to true to also query for email aliases
+ldap.queryEmailForAliases = true
 
 # The database instance local unique identifier. Used when the new database is created.
 database-instance = TEST
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java
index dad82546b5cbc8c0b5906140b430cc9375ed96a5..221b3612fb58b51a7ceec0f5bc6bf757617d259d 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/AbstractServer.java
@@ -253,7 +253,7 @@ public abstract class AbstractServer<T> extends AbstractServiceWithLogger<T> imp
         assert persons.size() > 0 : "At least system user should be in the database";
         // If only one user (system user), then this is the first logged user.
         final boolean isFirstLoggedUser = (persons.size() == 1);
-        PersonPE person = daoFactory.getPersonDAO().tryFindPersonByUserId(user);
+        PersonPE person = daoFactory.getPersonDAO().tryFindPersonByUserId(session.getUserName());
         if (person == null)
         {
             final PersonPE systemUser = getSystemUser(persons);
diff --git a/openbis/source/java/genericApplicationContext.xml b/openbis/source/java/genericApplicationContext.xml
index 1a2e115708b60d18dc94e4e438dbe8126bd44261..64309e3181f6919fbfac5b87829faf04ccc3a02c 100644
--- a/openbis/source/java/genericApplicationContext.xml
+++ b/openbis/source/java/genericApplicationContext.xml
@@ -60,6 +60,8 @@
         </constructor-arg>
         <!-- The time after which an inactive session is expired by the service (in minutes). -->
         <constructor-arg value="${session-timeout}" />
+        <!-- Enable login with email addresses -->
+        <constructor-arg value="true" />
     </bean>
     
     <bean id="remote-host-validator" class="ch.systemsx.cisd.openbis.generic.server.WhiteListBasedRemoteHostValidator">