]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Adding a "Register" link to the Walled Garden login screen.
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 1 Jun 2010 22:18:14 +0000 (22:18 +0000)
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 1 Jun 2010 22:18:14 +0000 (22:18 +0000)
This mimics pre-existing "Lost Password" functionality without redirecting to an internal page.

git-svn-id: http://code.elgg.org/elgg/trunk@6314 36083f99-b078-4883-b0ff-0f9b5a30f544

views/default/account/forms/login_walled_garden.php
views/default/css.php

index 05c8215a87f7ee4964547dd537310aa26783037c..c889beff759bd1fa075dfa34295dbd8e290db458 100644 (file)
@@ -11,7 +11,13 @@ $form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/pa
 $form_body .= elgg_view('input/hidden', array('internalname' => 'returntoreferer', 'value' => 'true'));
 $form_body .= elgg_view('input/submit', array('value' => elgg_echo('login')));
 $form_body .= "<div class='remember_me'><label><input type='checkbox' name='persistent' checked value='true' />".elgg_echo('user:persistent')."</label></div>";
-$form_body .= "<p class='lost_password'><a class='forgotten_password_link' href=\"{$login_url}account/forgotten_password.php\">" . elgg_echo('user:password:lost') . "</a></p>";
+
+$register = elgg_echo('register');
+$lost_password = elgg_echo('user:password:lost');
+$form_body .= '<p class="lost_password">';
+$form_body .= $CONFIG->allow_registration ? "<a class=\"registration_link\" href=\"{$vars['url']}pg/register/\">$register</a> | " : '';
+$form_body .= "<a class='forgotten_password_link' href=\"{$login_url}account/forgotten_password.php\">$lost_password</a>";
+$form_body .= '</p>';
 
 $login_url = $vars['url'];
 if ((isset($CONFIG->https_login)) && ($CONFIG->https_login)) {
@@ -27,7 +33,24 @@ if ((isset($CONFIG->https_login)) && ($CONFIG->https_login)) {
        echo elgg_view('login/extend'); // view for plugins to extend
 ?>
 
-<div class="lostpassword_form margin_top hidden">
+<?php
+if ($CONFIG->allow_registration) {
+       $title = elgg_echo('register');
+       $body = elgg_view("account/forms/register", array(
+               'friend_guid' => (int) get_input('friend_guid', 0),
+               'invitecode' => get_input('invitecode'),
+       ));
+
+       echo <<<__HTML
+<div id="registration_form" class="registration_form margin_top hidden">
+       <h2>$title</h2>
+       $body
+</div>
+__HTML;
+}
+?>
+
+<div id="lostpassword_form" class="lostpassword_form margin_top hidden">
        <?php
        $lostpassword_form_body = "<p>" . elgg_echo('user:password:text') . "</p>";
        $lostpassword_form_body .= "<p class='margin_none'><label>". elgg_echo('username') . " "
@@ -50,10 +73,23 @@ if ((isset($CONFIG->https_login)) && ($CONFIG->https_login)) {
 $(document).ready(function() {         
        $('input.username').focus();
        
+       $('a.registration_link').click(function(e) {
+               e.preventDefault();
+               if ($('#lostpassword_form').is(':visible')) {
+                       elgg_slide_toggle($('a.forgotten_password_link'), '.walledgardenlogin', '.lostpassword_form');
+               }
+               
+               elgg_slide_toggle(this, '.walledgardenlogin', '.registration_form');
+       });
+       
        $('a.forgotten_password_link').click(function(e) {
                e.preventDefault();
+               if ($('#registration_form').is(':visible')) {
+                       elgg_slide_toggle($('a.registration_link'), '.walledgardenlogin', '.registration_form');
+               }
+               
                elgg_slide_toggle(this, '.walledgardenlogin', '.lostpassword_form');
                $('input.lostusername').focus();
-       });                     
-});                    
+       });
+});
 </script>
index 3b5e2efc01763040e0e696eca8b6ce0bedddf5e8..43afbb1ea8156cc55e13b6a1e84e7fe29dc08afe 100644 (file)
@@ -1609,7 +1609,8 @@ p.elgg_likes_owner {
 .walledgardenlogin .lost_password {
        margin-bottom: 10px;
 }
-.walledgardenlogin a.forgotten_password_link {
+.walledgardenlogin a.forgotten_password_link,
+.walledgardenlogin a.registration_link {
        color:#999999;
 }
 #walledgarden_sysmessages #elgg_system_message {