You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
f"AuthAPI.login: plugin.check_credentials returned {check}"
1312
1321
)
1313
1322
ifcheck:
@@ -1316,19 +1325,29 @@ def login(auth):
1316
1325
# "email": username + "@localhost",
1317
1326
"sso_id": plugin_name+":"+username,
1318
1327
}
1319
-
# and register the user if we have one, just in case
1328
+
# For AD, use the real email if available
1329
+
if (
1330
+
plugin_name=="ldap"
1331
+
andgetattr(plugin, "mode", None) =="ad"
1332
+
andgetattr(plugin, "last_user_mail", None)
1333
+
):
1334
+
auth.logger.debug(f"AuthAPI.login: Using AD email from LDAP plugin: {plugin.last_user_mail}")
1335
+
# save the real email from AD to database
1336
+
data["email"] =plugin.last_user_mail
1337
+
else:
1338
+
auth.logger.debug(f"AuthAPI.login: Not using AD email, plugin_name={plugin_name}, mode={getattr(plugin, 'mode', None)}, last_user_mail={getattr(plugin, 'last_user_mail', None)}")
1320
1339
ifauth.db:
1321
-
self.logger.debug(
1340
+
auth.logger.debug(
1322
1341
f"AuthAPI.login: Calling get_or_register_user with data={data}"
1323
1342
)
1324
1343
user=auth.get_or_register_user(data)
1325
-
self.logger.debug(
1344
+
auth.logger.debug(
1326
1345
f"AuthAPI.login: User after get_or_register_user: {user}"
1327
1346
)
1328
1347
auth.store_user_in_session(user["id"])
1329
1348
# else: if we're here - check is OK, but user is not in the session - is it right?
1330
1349
else:
1331
-
self.logger.debug(
1350
+
auth.logger.debug(
1332
1351
f"AuthAPI.login: plugin.check_credentials failed for {username}"
0 commit comments