]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/login.php
added a script for adding old replies in
[quix0rs-gnu-social.git] / actions / login.php
index fe2ae5c1c459a3b2b72108c3f9812b55698cb54d..a4e8b33cd9e1b062d2b2f013fa11a6b2ab861019 100644 (file)
@@ -23,7 +23,7 @@ class LoginAction extends Action {
 
        function handle($args) {
                parent::handle($args);
-               if (common_logged_in()) {
+               if (common_is_real_login()) {
                        common_user_error(_t('Already logged in.'));
                } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                        $this->check_login();
@@ -45,6 +45,7 @@ class LoginAction extends Action {
                        }
                        common_real_login(true);
                        if ($this->boolean('rememberme')) {
+                               common_debug('Adding rememberme cookie');
                                common_rememberme();
                        }
                        # success!
@@ -65,26 +66,39 @@ class LoginAction extends Action {
 
        function show_form($error=NULL) {
                common_show_header(_t('Login'), NULL, $error, array($this, 'show_top'));
-               common_element_start('form', array('method' => 'POST',
+               common_element_start('form', array('method' => 'post',
                                                                                   'id' => 'login',
                                                                                   'action' => common_local_url('login')));
                common_input('nickname', _t('Nickname'));
                common_password('password', _t('Password'));
-               common_checkbox('rememberme', _t('Remember me'),
-                               _t('Automatically login in the future; ' . 
+               common_checkbox('rememberme', _t('Remember me'), false,
+                               _t('Automatically login in the future; ' .
                                   'not for shared computers!'));
                common_submit('submit', _t('Login'));
                common_element_end('form');
+               common_element_start('p');
+               common_element('a', array('href' => common_local_url('recoverpassword')),
+                                          _t('Lost or forgotten password?'));
+               common_element_end('p');
                common_show_footer();
        }
-       
+
+       function get_instructions() {
+               return _t('Login with your username and password. ' .
+                                 'Don\'t have a username yet? ' .
+                                 '[Register](%%action.register%%) a new account, or ' .
+                                 'try [OpenID](%%action.openidlogin%%). ');
+       }
+
        function show_top($error=NULL) {
                if ($error) {
                        common_element('p', 'error', $error);
                } else {
-                       common_element('p', 'instructions', 
-                                                  _t('Login with your username and password. ' .
-                                                         'Don\'t have a username yet? Choose register above. '));
+                       $instr = $this->get_instructions();
+                       $output = common_markup_to_html($instr);
+                       common_element_start('p', 'instructions');
+                       common_raw($output);
+                       common_element_end('p');
                }
        }
 }