mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 21:43:11 +00:00
Merge pull request #663 from tdonohue/DS-1781
DS-1781 : Ensure LDAP "email_field" is not ignored entirely
This commit is contained in:
@@ -250,17 +250,24 @@ public class LDAPAuthentication
|
|||||||
log.info(LogManager.getHeader(context,
|
log.info(LogManager.getHeader(context,
|
||||||
"autoregister", "netid=" + netid));
|
"autoregister", "netid=" + netid));
|
||||||
|
|
||||||
// If there is no email and the email domain is set, add it to the netid
|
|
||||||
String email = ldap.ldapEmail;
|
String email = ldap.ldapEmail;
|
||||||
|
|
||||||
if ((StringUtils.isEmpty(email)) &&
|
// Check if we were able to determine an email address from LDAP
|
||||||
(StringUtils.isNotEmpty(ConfigurationManager.getProperty("authentication-ldap", "netid_email_domain"))))
|
if (StringUtils.isEmpty(email))
|
||||||
{
|
{
|
||||||
email = netid + ConfigurationManager.getProperty("authentication-ldap", "netid_email_domain");
|
// If no email, check if we have a "netid_email_domain". If so, append it to the netid to create email
|
||||||
}
|
if (StringUtils.isNotEmpty(ConfigurationManager.getProperty("authentication-ldap", "netid_email_domain")))
|
||||||
else
|
{
|
||||||
{
|
email = netid + ConfigurationManager.getProperty("authentication-ldap", "netid_email_domain");
|
||||||
email = netid;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We don't have a valid email address. We'll default it to 'netid' but log a warning
|
||||||
|
log.warn(LogManager.getHeader(context, "autoregister",
|
||||||
|
"Unable to locate email address for account '" + netid + "', so it has been set to '" + netid + "'. " +
|
||||||
|
"Please check the LDAP 'email_field' OR consider configuring 'netid_email_domain'."));
|
||||||
|
email = netid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(email))
|
if (StringUtils.isNotEmpty(email))
|
||||||
|
Reference in New Issue
Block a user