AngellusMortis / django_microsoft_auth

Simple app to enable Microsoft Account, Office 365 and Xbox Live authentcation as a Django authentcation backend.
MIT License
137 stars 84 forks source link

First & Last Name Improperly Handled When AD Name In Format `First.Last` #486

Closed korverdev closed 1 year ago

korverdev commented 1 year ago

Our AD stores names in the format First.Last. This results in a user model entry where the first name is "First.Last" and the last name is blank. This format doesn't appear to be supported based on this snippet that handles these formats.

korverdev commented 1 year ago

A few ideas on options to address:

  1. Add another try/except block handling this format, since this a pretty common standard.
  2. Allow users to set their own string in settings.py used to break up first and last names.
  3. Add a bit of logic breaking up the name based on any characters that aren't letters, apostrophes, or hyphens unless the name's in the format Last, First.

@AngellusMortis I can put together a PR fixing this, but I'd love some guidance on what you think the best way to address this issue is.