문제

Anyone know how to create a "remember me" checkbox in the joomla ADMIN login form? I am tired to "re-login" everytime that I need to change something in the backend.

I have created the checkbox, but I'm facing some issues to make it work. Thank you in advance

Am I donig something wrong? Still not working.

This is the code I added to the mod_login in default.php "\administrator\modules\mod_login\tmpl\default.php":

<!-- BEGIN - Trying to create Remember me-->
<p id="form-login-remember">
<label for="modlgn-remember"><?php echo 'Remember-me' ?>&#160;</label>
<input id="modlgn-remember" type="checkbox" name="remember" class="inputbox" value="yes"/>
</p>
<!-- END - Trying to create Remember me-->

And this is part of the controler:

    /**
 * Method to log in a user.
 *
 * @return  void
 */
public function login()
{
    // Check for request forgeries.
    JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN'));

    $app = JFactory::getApplication();

    $model = $this->getModel('login');
    $credentials = $model->getState('credentials');
    $return = $model->getState('return');

    $result = $app->login($credentials, array('action' => 'core.login.admin'));

    if (!($result instanceof Exception)) {
        $app->redirect($return);
    }

    parent::display();
}
도움이 되었습니까?

해결책

You just Need to create a check box with name remember.

It will do the rest. when the admin login form submit the corresponding task is written on the

administrator/compoenets/com_login/controller.php

You can find a function with name login()

Just check that code something like this.

$options['remember'] = JRequest::getBool('remember', true);

Also make sure cookie path are correct ,If you are working with subdomain sometime path will create issue.

Hope this may help you..

다른 팁

You can try This plugin to keep alive the session, but is limited too.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top