Commit ed59cfeb authored by Rafael Monnerat's avatar Rafael Monnerat

erp5_authentication_policy: Include a fail safe in case the Login isn't under Person

   Only Person could include getFirstName and getLastName, so implement a fail-safe in case Login is inside a Computer or any other document.
parent 0792aec3
...@@ -69,8 +69,8 @@ if portal.portal_preferences.isPrefferedForceUsernameCheckInPassword(): ...@@ -69,8 +69,8 @@ if portal.portal_preferences.isPrefferedForceUsernameCheckInPassword():
lower_password = password.lower() lower_password = password.lower()
if not is_temp_object: if not is_temp_object:
# real object # real object
first_name = context.getFirstName() first_name = getattr(context, 'getFirstName', context.getTitle)()
last_name = context.getLastName() last_name = getattr(context, 'getLastName', context.getReference)()
else: else:
# temporary object # temporary object
first_name = getattr(context, 'first_name', None) first_name = getattr(context, 'first_name', None)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment