LDAP user without mailbox gets nasty error when trying to log in if admins have configured a list of whitelisted domains for signup
Summary
When Gitlab has been set up with LDAP and there are entries in the "Whitelisted domains" section in the Administration a user without a mailaccount attached (a serviceaccount for monitoring purposes in our case) gets an errormessage stating that "could not authenticate you from ldapmain because "Undefined method 'provider' for nil:nilclass"".
We wasted a few hours bughunting this error until we found out the nature of the error. Proper feedback to the user upon login would have spared us many grey hairs
Steps to reproduce
Set up LDAP Create an AD account without a mailaccount (I am not sure how) - I will be happy to provide details on the account we experienced this behaviour with if required Enter at least one domain in the "Whitelisted domains" section in Administration
Expected behavior
The user should get a human readable errormessage
Actual behavior
An errormessage saying "could not authenticate you from ldapmain because "Undefined method 'provider' for nil:nilclass""