self.cname = raw_ldap[0]
self.ldap_atts = raw_ldap[1]
+ self.lang_pref = self._simple_map('preferredLanguage')
+
if 'mail' not in self.ldap_atts:
- print >> sys.stderr, 'mail not found for %s' % self.cname
+ if self.lang_pref and self.lang_pref == 'f':
+ self.email = self.cname + '@laurentienne.ca'
+ else:
+ self.email = self.cname + '@laurentian.ca'
+ print >> sys.stderr, '"mail" not found for %s, using %s' % (self.cname, self.email)
# return None
+ else:
+ self.email = (self._simple_map('mail') or '').lower()
# Strip leading/ending whitespace; LDAP data can be dirty
# Using email for username deliberately here
- self.usrname = (self._simple_map('mail') or '').lower()
- self.email = (self._simple_map('mail') or '').lower()
+ self.usrname = self.email
self.family_name = self._simple_map('sn')
self.ident_type, self.ident_value = self.get_identity()
self.home_ou = self.get_home_ou()
if not self.first_given_name:
self.first_given_name = 'LDAP_NULL'
print >> sys.stderr, 'No givenName for %s' % (self.usrname)
- self.lang_pref = self._simple_map('preferredLanguage')
# Randomized password, assuming user will use "Forgot password"
# function to set their own password