From 903802e3fc781e3dad39f790248c595639b2bfe3 Mon Sep 17 00:00:00 2001 From: Rafael Monnerat <rafael@nexedi.com> Date: Tue, 18 Aug 2020 22:11:57 +0000 Subject: [PATCH] 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. --- .../erp5_authentication_policy/Login_analyzePassword.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bt5/erp5_authentication_policy/SkinTemplateItem/portal_skins/erp5_authentication_policy/Login_analyzePassword.py b/bt5/erp5_authentication_policy/SkinTemplateItem/portal_skins/erp5_authentication_policy/Login_analyzePassword.py index e5e9ba145f..df52725919 100644 --- a/bt5/erp5_authentication_policy/SkinTemplateItem/portal_skins/erp5_authentication_policy/Login_analyzePassword.py +++ b/bt5/erp5_authentication_policy/SkinTemplateItem/portal_skins/erp5_authentication_policy/Login_analyzePassword.py @@ -69,8 +69,8 @@ if portal.portal_preferences.isPrefferedForceUsernameCheckInPassword(): lower_password = password.lower() if not is_temp_object: # real object - first_name = context.getFirstName() - last_name = context.getLastName() + first_name = getattr(context, 'getFirstName', context.getTitle)() + last_name = getattr(context, 'getLastName', context.getReference)() else: # temporary object first_name = getattr(context, 'first_name', None) -- 2.30.9