projects
/
Plinn.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Gestion de l'option « email_as_login ».
[Plinn.git]
/
Products
/
Plinn
/
RegistrationTool.py
diff --git
a/Products/Plinn/RegistrationTool.py
b/Products/Plinn/RegistrationTool.py
index
44b3034
..
fff500e
100644
(file)
--- a/
Products/Plinn/RegistrationTool.py
+++ b/
Products/Plinn/RegistrationTool.py
@@
-183,7
+183,7
@@
class RegistrationTool(BaseRegistrationTool) :
private_collections = portal.get('private_collections')
if not private_collections :
raise AccessControl_Unauthorized()
private_collections = portal.get('private_collections')
if not private_collections :
raise AccessControl_Unauthorized()
- return
+
data = private_collections.data
lines = filter(None, [l.strip() for l in data.split('\n')])
assert len(lines) % 3 == 0
data = private_collections.data
lines = filter(None, [l.strip() for l in data.split('\n')])
assert len(lines) % 3 == 0
@@
-194,7
+194,6
@@
class RegistrationTool(BaseRegistrationTool) :
if not (collecInfos.has_key(properties.get('collection_id')) and \
collecInfos[properties.get('collection_id')]['pw'] == properties.get('collection_password')) :
raise AccessControl_Unauthorized('Wrong primary credentials')
if not (collecInfos.has_key(properties.get('collection_id')) and \
collecInfos[properties.get('collection_id')]['pw'] == properties.get('collection_password')) :
raise AccessControl_Unauthorized('Wrong primary credentials')
- return
BaseRegistrationTool.addMember(self, id, password, roles=roles,
BaseRegistrationTool.addMember(self, id, password, roles=roles,
@@
-233,7
+232,7
@@
class RegistrationTool(BaseRegistrationTool) :
return str(uuid4())
security.declarePublic('requestPasswordReset')
return str(uuid4())
security.declarePublic('requestPasswordReset')
- def requestPasswordReset(self, userid, initial
ize
=False):
+ def requestPasswordReset(self, userid, initial=False):
""" add uuid / (userid, expiration) pair
if ok: send an email to member. returns error message otherwise.
"""
""" add uuid / (userid, expiration) pair
if ok: send an email to member. returns error message otherwise.
"""
@@
-263,12
+262,15
@@
class RegistrationTool(BaseRegistrationTool) :
mailhost = portal.MailHost
sender = encodeQuopriEmail(ptool.getProperty('email_from_name'), ptool.getProperty('email_from_address'))
to = encodeQuopriEmail(member.getMemberFullName(nameBefore=0), member.getProperty('email'))
mailhost = portal.MailHost
sender = encodeQuopriEmail(ptool.getProperty('email_from_name'), ptool.getProperty('email_from_address'))
to = encodeQuopriEmail(member.getMemberFullName(nameBefore=0), member.getProperty('email'))
- if initial
ize
:
- subject = translate(_('
How to initialize your password
on the %s website')) % ptool.getProperty('title')
+ if initial :
+ subject = translate(_('
Complete your registration
on the %s website')) % ptool.getProperty('title')
else :
subject = translate(_('How to reset your password on the %s website')) % ptool.getProperty('title')
subject = encodeMailHeader(subject)
else :
subject = translate(_('How to reset your password on the %s website')) % ptool.getProperty('title')
subject = encodeMailHeader(subject)
- options = {'fullName' : member.getMemberFullName(nameBefore=0),
+ options = {'initial' : initial,
+ 'fullName' : member.getMemberFullName(nameBefore=0),
+ 'member_id' : member.getId(),
+ 'loginIsNotEmail' : member.getId() != member.getProperty('email'),
'siteName' : ptool.getProperty('title'),
'resetPasswordUrl' : '%s/password_reset_form/%s' % (utool(), uuid)}
body = self.password_reset_mail(options)
'siteName' : ptool.getProperty('title'),
'resetPasswordUrl' : '%s/password_reset_form/%s' % (utool(), uuid)}
body = self.password_reset_mail(options)
@@
-313,7
+315,8
@@
class RegistrationTool(BaseRegistrationTool) :
del self._passwordResetRequests[uuid]
return userid, _('Password successfully updated.')
else :
del self._passwordResetRequests[uuid]
return userid, _('Password successfully updated.')
else :
- return None, _('"%s" username not found.') % userid
-
+ return None, _('"${userid}" username not found.', mapping={'userid': userid})
+ else :
+ return None, msg
InitializeClass(RegistrationTool)
\ No newline at end of file
InitializeClass(RegistrationTool)
\ No newline at end of file