diff --git a/ldap.py b/ldap.py
index 47a079ee877798942a8564120f3607976eff64f5..61adcd30523f5d63ec2c797367dea26e1d291c47 100644
--- a/ldap.py
+++ b/ldap.py
@@ -7,7 +7,7 @@ if 'LDAP_HOST' in config:
 	import ldap3
 
 	def ldapauth(user, password): # pylint: disable=function-redefined
-		if LDAP_USERRE.search(user):
+		if not user or not password or LDAP_USERRE.search(user):
 			return {}, []
 		try:
 			server = ldap3.Server(config['LDAP_HOST'], port=config['LDAP_PORT'], use_ssl=True)