Dieter Maurer wrote:
Norbert Marrale wrote at 2006-8-3 15:22 -0400:
Upon their initial registration, many users entered their email address
in upper or mixed case. The email > username(s) lookup is meant to
alleviate the number of support requests, allowing members to receive
password reminders even if they forget their registration handles.
This means they have not only forgotten their password but also their
userid?
If they still know the userid, you can directly access the corresponding
user record.
If you did not store the userid normalized, then the best way
would be to do normalization of the userid.
Yes, that's correct: they forget their userids on a regular basis. And
yes, userids are already stored normalized. *Forgotten* userids is why I
implemented the hack in mail_password (see below).
Which brings me to my original Q...
Is there a better way than the two-step approach I'm following:
emails = context.portal_membership.searchMembers('email','')
and then iterate over emails to find the matches
if (member==string.lower(emails[n].values()[1])):
Or if this can't be done in a less costly way, where would I start with
normalizing the email address records that are already stored?
Sorry if I didn't express myself clearly enough before. Thanks!
Norbert
-code below-
mail=0
mail_chars='.@'
member=string.lower(REQUEST['userid'])
for i in range(len(mail_chars)):
if string.find(member, mail_chars[i]) != -1:
mail += 1
if mail >= 2:
# this is probably an email address
emails = context.portal_membership.searchMembers('email','')
for n in range(0,len(emails),1):
if (member==string.lower(emails[n].values()[1])):
REQUEST.set('userid',str(emails[n].values()[0]))
context.portal_registration.mailPassword(REQUEST['userid'], REQUEST)
_______________________________________________
Zope-CMF maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope-cmf
See http://collector.zope.org/CMF for bug reports and feature requests