Add error handling for when LDAP "Full Name Attribute" has no white space.
Review Request #9211 — Created Sept. 23, 2017 and submitted — Latest diff uploaded
When setting up LDAP authentication, an uncaught exception may be thrown
when splitting the full name into first name and last name. This happens
when the full name contains no space.
If this exception occurs it will now assign the full name to the first
name, and make the last name an empty string.
Because there was a comment just above my changes explaining how full
name is split between first and last name, I added to it to explain what
happens to first and last name in this situation.
I was not able to properly reproduce and test this manually because I
could not get a LDAP server up and running.
I have written a unit test that provides the modified function,
get_or_create_user(), with a user that has a full name containing no
spaces and verifies that the first and last name are assigned as
This test passes with this fix, and fails on 2.5.x without the fix.