Redirection vers url passée en paramètre « came_from » lors de l'inscription.
[Plinn.git] / Products / Plinn / skins / custom_generic / join_template.pt
index 337aa94..eb33650 100644 (file)
@@ -11,7 +11,7 @@
                 tal:define="form options/form">
       <h1 i18n:translate="">Become a member</h1>
       <div class="Desktop">
-        <p tal:condition="not:options/isAnon" i18n:translate="">
+        <p tal:condition="options/isOrdinaryMember" i18n:translate="">
             You are already authenticated. You may use the
             <a tal:attributes="href string:$portal_url/personalize_form"
                i18n:name="personalize_form"
         <div tal:condition="python:options['isNewMember'] and options['isAnonRegistration']">
           <p i18n:translate="">You have been registered as a member.</p>
           <p tal:condition="options/validate_email" i18n:translate="">
-            You will receive an email shortly containing your password and
-            instructions on how to activate your membership.
+            You will receive an email shortly. Please follow sent instructions
+            to complete your registration.
           </p>
           <tal:case tal:condition="not: options/validate_email">
             <p i18n:translate="">Click the button to log in immediately.</p>
-            <form tal:attributes="action form/action">
+            <form tal:attributes="action form/action" method="post">
               <input type="hidden" name="__ac_name" tal:attributes="value options/member_id"/>
               <input type="hidden" name="__ac_password" tal:attributes="value options/password"/>
+              <input type="hidden" name="came_from" tal:attributes="value options/came_from">
               <input type="hidden" name="noAjax" value="1"/>
               <metal:macro metal:use-macro="context/form_widgets/macros/buttons"/>
             </form>
@@ -54,7 +55,7 @@
         </div>
         
         <div tal:condition="options/isAnon">
-          <form method="post" tal:attributes="action form/action">
+          <form method="post" tal:attributes="action form/action" id="registration-form">
             <table>
               <tr>
                 <td>
               </tr>
               <tr>
                 <td colspan="2">
-                  <input type="text" name="member_email"
+                  <input type="text" name="member_email" size="30"
                          placeholder="Email address" i18n:attributes="placeholder"
                          tal:attributes="value options/member_email|nothing"/>
                   <label>
                     <input type="checkbox" name="email_as_login" value="email_as_login"
-                           tal:attributes="checked python:options.get('email_as_login', True)"/>
+                           tal:attributes="checked python:options['email_as_login']"/>
                     <span tal:omit-tag="" i18n:translate="">use as login</span>
                   </label>
                 </td>
               </tr>
-              <tr>
+              <tr id="login-row"
+                  tal:attributes="class python:'hidden' if options['email_as_login'] else nothing">
                 <td colspan="2">
                   <input type="text" name="member_id"
                          placeholder="login" i18n:attributes="placeholder"
               <tbody tal:condition="not: options/validate_email" tal:omit-tag="">
                 <tr>
                   <td colspan="2">
-                    <input type="password" name="password"
+                    <input type="password" name="password" size="25"
                            placeholder="Password" i18n:attributes="placeholder"/>
                   </td>
                 </tr>
                 <tr>
                   <td colspan="2">
-                    <input type="password" name="confirm"
+                    <input type="password" name="confirm" size="25"
                            placeholder="Password (confirm)" i18n:attributes="placeholder"/>
                   </td>
                 </tr>
                 </td>
               </tr>
             </table>
+            <input type="hidden" name="came_from"
+                   tal:attributes="value options/came_from"/>
           </form>
+          <script type="text/javascript">
+            (function(){
+              var login_row = document.getElementById('login-row');
+              var form = document.getElementById('registration-form');
+              var cb = form.elements.namedItem('email_as_login');
+              addListener(cb,
+                          'change',
+                          function(){
+                            if (cb.checked)
+                              login_row.className = 'hidden';
+                            else
+                              login_row.className = null;
+                          }
+                          );
+            }());
+          </script>
         </div>
         
       </div>