From: Benoît Pin Date: Thu, 16 Apr 2015 17:03:20 +0000 (+0200) Subject: Gestion de l'option « email_as_login ». X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/commitdiff_plain/55fa8d8e6b6b1562174b12c2658dd463c9b018dc Gestion de l'option « email_as_login ». --- diff --git a/Products/Plinn/locales/en/LC_MESSAGES/plinn.mo b/Products/Plinn/locales/en/LC_MESSAGES/plinn.mo index 33fce5d..da9314c 100644 Binary files a/Products/Plinn/locales/en/LC_MESSAGES/plinn.mo and b/Products/Plinn/locales/en/LC_MESSAGES/plinn.mo differ diff --git a/Products/Plinn/locales/en/LC_MESSAGES/plinn.po b/Products/Plinn/locales/en/LC_MESSAGES/plinn.po index 6a1d966..4ac4724 100644 --- a/Products/Plinn/locales/en/LC_MESSAGES/plinn.po +++ b/Products/Plinn/locales/en/LC_MESSAGES/plinn.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: 2.0 beta 1\n" -"POT-Creation-Date: Thu Apr 16 16:35:11 2015\n" +"POT-Creation-Date: Thu Apr 16 18:57:18 2015\n" "PO-Revision-Date: 2015-04-15 17:00+0200\n" "Last-Translator: FULL NAME \n" "Language-Team: Zope 3 Developers \n" @@ -32,33 +32,33 @@ msgstr "Object deleted" msgid "Please rename each listed object." msgstr "Please rename each listed object." -#: n/RegistrationTool.py:267 +#: n/RegistrationTool.py:266 msgid "Complete your registration on the %s website" msgstr "Complete your registration on the %s website" -#: n/RegistrationTool.py:269 +#: n/RegistrationTool.py:268 msgid "How to reset your password on the %s website" msgstr "How to reset your password on the %s website" -#: n/RegistrationTool.py:287 +#: n/RegistrationTool.py:286 msgid "Unknown user name. Please retry." msgstr "Unknown user name. Please retry." -#: n/RegistrationTool.py:302 +#: n/RegistrationTool.py:301 msgid "Invalid reset password request." msgstr "Invalid reset password request." -#: n/RegistrationTool.py:308 +#: n/RegistrationTool.py:307 msgid "Your reset password request has expired. You can ask a new one." msgstr "Your reset password request has expired. You can ask a new one." -#: n/RegistrationTool.py:317 +#: n/RegistrationTool.py:316 msgid "Password successfully updated." msgstr "Password successfully updated." -#: n/RegistrationTool.py:319 -msgid "\"%s\" username not found." -msgstr "\"%s\" username not found." +#: n/RegistrationTool.py:318 +msgid "\"${userid}\" username not found." +msgstr "\"${userid}\" username not found." #: n/profiles/default/workflows/default_workflow/scripts/sendNotificationEmail.py:52 #: n/profiles/default/workflows/folder_workflow/scripts/sendNotificationEmail.py:52 @@ -600,7 +600,7 @@ msgstr "More..." msgid "Success!" msgstr "Success!" -#: n/skins/custom_generic/join_form.py:67 +#: n/skins/custom_generic/join_form.py:68 #: n/skins/photo_theme/photo_main_macros.pt:28 msgid "Join" msgstr "Join" @@ -681,17 +681,17 @@ msgstr "Email address" msgid "use as login" msgstr "use as login" -#: n/skins/custom_generic/join_template.pt:85 +#: n/skins/custom_generic/join_template.pt:86 msgid "login" msgstr "login" -#: n/skins/custom_generic/join_template.pt:93 +#: n/skins/custom_generic/join_template.pt:94 #: n/skins/custom_generic/login_form.pt:28 n/skins/generic/gruf_macros.pt:268 #: n/skins/generic/gruf_macros.pt:390 msgid "Password" msgstr "Password" -#: n/skins/custom_generic/join_template.pt:99 +#: n/skins/custom_generic/join_template.pt:100 msgid "Password (confirm)" msgstr "Password (confirm)" @@ -2941,6 +2941,9 @@ msgstr "Directory" msgid "Configure portal" msgstr "Configure portal" +#~ msgid "\"%s\" username not found." +#~ msgstr "\"%s\" username not found." + #~ msgid "Your personal login to log in later is:" #~ msgstr "Your personal login to log in later is:" diff --git a/Products/Plinn/locales/fr/LC_MESSAGES/plinn.mo b/Products/Plinn/locales/fr/LC_MESSAGES/plinn.mo index 39d1633..0f0ede2 100644 Binary files a/Products/Plinn/locales/fr/LC_MESSAGES/plinn.mo and b/Products/Plinn/locales/fr/LC_MESSAGES/plinn.mo differ diff --git a/Products/Plinn/locales/fr/LC_MESSAGES/plinn.po b/Products/Plinn/locales/fr/LC_MESSAGES/plinn.po index 2ac8829..da60150 100644 --- a/Products/Plinn/locales/fr/LC_MESSAGES/plinn.po +++ b/Products/Plinn/locales/fr/LC_MESSAGES/plinn.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: Plinn 2.0\n" -"POT-Creation-Date: Thu Apr 16 16:35:11 2015\n" +"POT-Creation-Date: Thu Apr 16 18:57:18 2015\n" "PO-Revision-Date: 2015-04-15 15:06+0200\n" "Last-Translator: Benoît PIN\n" "Language-Team: CRI http://cri.ensmp.fr\n" @@ -24,35 +24,35 @@ msgstr "Objet supprimé" msgid "Please rename each listed object." msgstr "Veuillez renommer tous les éléments listés." -#: n/RegistrationTool.py:267 +#: n/RegistrationTool.py:266 msgid "Complete your registration on the %s website" msgstr "Terminer votre inscription sur le site %s" -#: n/RegistrationTool.py:269 +#: n/RegistrationTool.py:268 msgid "How to reset your password on the %s website" msgstr "Comment réinitialiser votre mot de passe sur le site %s" -#: n/RegistrationTool.py:287 +#: n/RegistrationTool.py:286 msgid "Unknown user name. Please retry." msgstr "Nom d'utilisateur inconnu. Veuillez réessayer." -#: n/RegistrationTool.py:302 +#: n/RegistrationTool.py:301 msgid "Invalid reset password request." msgstr "Demande de réinitialisation de mot de passe invalide." -#: n/RegistrationTool.py:308 +#: n/RegistrationTool.py:307 msgid "Your reset password request has expired. You can ask a new one." msgstr "" "Votre demande de réinitialisation de mot de passe a expiré. Vous pouvez en " "demander une nouvelle." -#: n/RegistrationTool.py:317 +#: n/RegistrationTool.py:316 msgid "Password successfully updated." msgstr "Mot de passe correctement mis à jour." -#: n/RegistrationTool.py:319 -msgid "\"%s\" username not found." -msgstr "Nom : « %s » non trouvé." +#: n/RegistrationTool.py:318 +msgid "\"${userid}\" username not found." +msgstr "Identifiant « ${userid} » non trouvé." #: n/profiles/default/workflows/default_workflow/scripts/sendNotificationEmail.py:52 #: n/profiles/default/workflows/folder_workflow/scripts/sendNotificationEmail.py:52 @@ -593,7 +593,7 @@ msgstr "Plus…" msgid "Success!" msgstr "Succès !" -#: n/skins/custom_generic/join_form.py:67 +#: n/skins/custom_generic/join_form.py:68 #: n/skins/photo_theme/photo_main_macros.pt:28 msgid "Join" msgstr "S'inscrire" @@ -674,17 +674,17 @@ msgstr "Adresse e-mail" msgid "use as login" msgstr "utiliser comme identifiant" -#: n/skins/custom_generic/join_template.pt:85 +#: n/skins/custom_generic/join_template.pt:86 msgid "login" msgstr "identifiant" -#: n/skins/custom_generic/join_template.pt:93 +#: n/skins/custom_generic/join_template.pt:94 #: n/skins/custom_generic/login_form.pt:28 n/skins/generic/gruf_macros.pt:268 #: n/skins/generic/gruf_macros.pt:390 msgid "Password" msgstr "Mot de passe" -#: n/skins/custom_generic/join_template.pt:99 +#: n/skins/custom_generic/join_template.pt:100 msgid "Password (confirm)" msgstr "Confirmation" @@ -2960,6 +2960,9 @@ msgstr "Annuaire" msgid "Configure portal" msgstr "Configurer portail" +#~ msgid "\"%s\" username not found." +#~ msgstr "Nom : « %s » non trouvé." + #~ msgid "" #~ "You will receive an email shortly containing your password and " #~ "instructions on how to activate your membership." diff --git a/Products/Plinn/locales/plinn.pot b/Products/Plinn/locales/plinn.pot index 23989b6..00797b7 100644 --- a/Products/Plinn/locales/plinn.pot +++ b/Products/Plinn/locales/plinn.pot @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: 2.0 beta 1\n" -"POT-Creation-Date: Thu Apr 16 16:35:11 2015\n" +"POT-Creation-Date: Thu Apr 16 18:57:18 2015\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Zope 3 Developers \n" @@ -31,32 +31,32 @@ msgstr "" msgid "Please rename each listed object." msgstr "" -#: n/RegistrationTool.py:267 +#: n/RegistrationTool.py:266 msgid "Complete your registration on the %s website" msgstr "" -#: n/RegistrationTool.py:269 +#: n/RegistrationTool.py:268 msgid "How to reset your password on the %s website" msgstr "" -#: n/RegistrationTool.py:287 +#: n/RegistrationTool.py:286 msgid "Unknown user name. Please retry." msgstr "" -#: n/RegistrationTool.py:302 +#: n/RegistrationTool.py:301 msgid "Invalid reset password request." msgstr "" -#: n/RegistrationTool.py:308 +#: n/RegistrationTool.py:307 msgid "Your reset password request has expired. You can ask a new one." msgstr "" -#: n/RegistrationTool.py:317 +#: n/RegistrationTool.py:316 msgid "Password successfully updated." msgstr "" -#: n/RegistrationTool.py:319 -msgid "\"%s\" username not found." +#: n/RegistrationTool.py:318 +msgid "\"${userid}\" username not found." msgstr "" #: n/profiles/default/workflows/default_workflow/scripts/sendNotificationEmail.py:52 @@ -600,7 +600,7 @@ msgstr "" msgid "Success!" msgstr "" -#: n/skins/custom_generic/join_form.py:67 +#: n/skins/custom_generic/join_form.py:68 #: n/skins/photo_theme/photo_main_macros.pt:28 msgid "Join" msgstr "" @@ -664,18 +664,18 @@ msgstr "" msgid "use as login" msgstr "" -#: n/skins/custom_generic/join_template.pt:85 +#: n/skins/custom_generic/join_template.pt:86 msgid "login" msgstr "" -#: n/skins/custom_generic/join_template.pt:93 +#: n/skins/custom_generic/join_template.pt:94 #: n/skins/custom_generic/login_form.pt:28 #: n/skins/generic/gruf_macros.pt:268 #: n/skins/generic/gruf_macros.pt:390 msgid "Password" msgstr "" -#: n/skins/custom_generic/join_template.pt:99 +#: n/skins/custom_generic/join_template.pt:100 msgid "Password (confirm)" msgstr "" diff --git a/Products/Plinn/skins/custom_generic/join_form.py b/Products/Plinn/skins/custom_generic/join_form.py index d65c8ef..8e82159 100644 --- a/Products/Plinn/skins/custom_generic/join_form.py +++ b/Products/Plinn/skins/custom_generic/join_form.py @@ -1,4 +1,4 @@ -##parameters=member_id='', given_name='', name='', member_email='', email_as_login='', password='', confirm='', add='', ajax='' +##parameters=member_id='', given_name='', name='', member_email='', password='', confirm='', add='', ajax='' ## from Products.CMFCore.utils import getToolByName from Products.CMFDefault.permissions import ManageUsers @@ -6,7 +6,6 @@ from Products.Plinn.RegistrationTool import MODE_ANONYMOUS, MODE_REVIEWED from Products.Plinn.utils import translate def _(message) : return translate(message, context).encode('utf-8') - mtool = getToolByName(script, 'portal_membership') ptool = getToolByName(script, 'portal_properties') rtool = getToolByName(script, 'portal_registration') @@ -18,8 +17,8 @@ is_anon = mtool.isAnonymousUser() is_newmember = False is_usermanager = mtool.checkPermission(ManageUsers, mtool) - form = context.REQUEST.form +email_as_login = bool(form.get('email_as_login', True if context.REQUEST.method == 'GET' else False)) if add : if validate_email : @@ -31,24 +30,26 @@ if add : try : if email_as_login : member_id = member_email - rtool.addMember(id=member_id, password=password, - properties={'username': member_id, - 'given_name' : given_name, - 'name' : name, - 'email': member_email}) + + rtool.addMember(id=member_id, password=password, + properties={'username': member_id, + 'given_name' : given_name, + 'name' : name, + 'email': member_email}) if validate_email : rtool.requestPasswordReset(member_id, initial=True) context.setStatus(True, _('Success!')) is_newmember = True is_anon = False except ValueError, errmsg: - context.setStatus(False, errmsg) + context.setStatus(False, errmsg) options = {} options['member_id'] = member_id options['given_name'] = given_name options['name'] = name options['member_email'] = member_email +options['email_as_login'] = email_as_login options['password'] = is_newmember and context.REQUEST.get('password', '') or '' options['portal_url'] = portal_url options['isAnon'] = is_anon @@ -60,12 +61,12 @@ options['isReviewedRegistration'] = rtool.getMode() == MODE_REVIEWED buttons = [] if is_newmember: - target = atool.getActionInfo('user/logged_in')['url'] - buttons.append( {'name': 'login', 'value': 'Log in'} ) + target = atool.getActionInfo('user/logged_in')['url'] + buttons.append( {'name': 'login', 'value': 'Log in'} ) else: - target = atool.getActionInfo('user/join')['url'] - buttons.append( {'name': 'add', 'value': _('Join')} ) + target = atool.getActionInfo('user/join')['url'] + buttons.append( {'name': 'add', 'value': _('Join')} ) options['form'] = { 'action': target, - 'listButtonInfos': tuple(buttons) } + 'listButtonInfos': tuple(buttons) } options['ajax']=ajax return context.join_template(**options) diff --git a/Products/Plinn/skins/custom_generic/join_template.pt b/Products/Plinn/skins/custom_generic/join_template.pt index 3434f56..4ac140b 100644 --- a/Products/Plinn/skins/custom_generic/join_template.pt +++ b/Products/Plinn/skins/custom_generic/join_template.pt @@ -54,7 +54,7 @@
-
+ - +
@@ -75,12 +75,13 @@ tal:attributes="value options/member_email|nothing"/>
+