Roundcube Community Forum

 

How to set remember_me plugin to be unchecked by default

Started by mattfox27, September 21, 2010, 01:44:05 AM

Previous topic - Next topic

mattfox27

I have the remember me plugin and i would like it to be unchecked by default.

rosali

Regards,
Rosali

mattfox27

#2
I downloaded it from the RC plugins page...its just the PHP file at the bottom Right?
 
I put it in its directory but everytime i go to it its checked
 
Is there a newer one? Or a better place to get it? I just reinstalled it fresh and it comes up checked.
 
Heres part of the code i have and it says checked=checked value=1...If that means anything. I tried putting "checked=unchecked" and that did not work...wierd
 
function rememberme_loginform($before)
{
$b = $before['content'];
$b = str_ireplace ('</tbody>',
'<td class=&quot;title[B]&quot;><label for=&quot;rcmloginpwd&quot;>Remember me</label></td><td><input name=&quot;_rememberme&quot; value=&quot;1&quot; checked=&quot;checked&quot; type=&quot;checkbox&quot;/></td>[/B]
</tbody>',$b);
$before['content']=$b;;
return ($before);

Heres the whole code that I have...Is this wrong?   ---> Remember_me.php

class remember_me extends rcube_plugin
{
private $key = 'Some random data';
function init()
{
$this->add_hook('template_object_loginform', array($this,'rememberme_loginform'));
$this->add_hook('startup', array($this, 'startup'));
$this->add_hook('authenticate', array($this, 'authenticate'));
$this->add_hook('login_after', array($this, 'login_after'));
$this->add_hook('login_failed', array($this, 'login_failed'));
}
function rememberme_loginform($before)
{
$b = $before['content'];
$b = str_ireplace ('',
'
',$b);
$before['content']=$b;;
return ($before);
}
function startup($args)
{
if ($args['task'] == 'mail' && empty($args['action']) && empty($_SESSION['user_id'])
&& !empty($_COOKIE['rememberme_user']) && !empty($_COOKIE['rememberme_pass']) )
$args['action'] = 'login';
 
if (($args['task'] == 'mail') && ($args['action'] == 'logout')) {$this->login_failed();};
return $args;
}
function authenticate($args)
{
if ( !empty($_COOKIE['rememberme_user']) && !empty($_COOKIE['rememberme_pass']))
{
$args['user']= $this->decode($_COOKIE['rememberme_user']);
$args['pass']= $this->decode($_COOKIE['rememberme_pass']);
#Update cookie time
setcookie ('rememberme_user',$this->encode($args['_user']),time()+60*60*24*356);
setcookie ('rememberme_pass',$this->encode($args['_pass']),time()+60*60*24*356);
};
return $args;
}
 
function login_after($args)
{
if (($_POST['_rememberme'] == 1) && !empty($_POST['_user']) && !empty($_POST['_pass']) )
{
setcookie ('rememberme_user',$this->encode($_POST['_user']),time()+60*60*24*356);
setcookie ('rememberme_pass',$this->encode($_POST['_pass']),time()+60*60*24*356);
};
}
function login_failed($args)
{
setcookie ('rememberme_user','',time()-3600);
setcookie ('rememberme_pass','',time()-3600);
}
private function encode ($a)
{
return base64_encode (mcrypt_encrypt (MCRYPT_DES,$this->key,$a,MCRYPT_MODE_ECB));
}
private function decode ($a)
{
return trim (mcrypt_decrypt (MCRYPT_DES,$this->key,base64_decode($a),MCRYPT_MODE_ECB),"\0");
}
 
};
 
 

mattfox27

Ok i got the remember_me plugin to work...Im very sorry im new to RC and i did not know that there was a another repository you download that has those plugins included i was just downloading off the RC webpage.  I get it now.  

The plugin repository is a little confusing if your new.  Thank You

K9Marc

Rosali,

Quick question, on your website with the RC login, does your site use all the plugins in your pack?

You have a nice looking set up and I would like to make mine look like what you have.

Thanks

Marc

mattfox27

So i got it setup but i had a question...When i login and do not select to remember me, when i log out it asks me if i want to save the cookie.  Should it do that if i do not select remember me when i log in?  Is it possible to change it so when you do not select remember me on log in, when you log off it just goes back to the login page.

Thanks

rosali

@ Marc: yes, I use all bundled plugins (some of them require hmailserver)

@mattfox27: This box is only shown if a cookie is present. Maybe in your case there is own from a prior session.
Regards,
Rosali

mattfox27

Ya its wierd even if i clear my cookies the remember me still presents me with a delete cookie upon exit.  Also when you press delete cookie is it supposed to redirect you to login page?   If not is there a way to do that?

rosali

#8
Yes it is supposed to redirect to login page. Could you give me remote access to your server? PM'me details. Otherwise I can't help you because it works for me.
Regards,
Rosali

mattfox27

I got it to work...it was a cookie problem on my end.  I started by using the wrong code and it put a bad cookie in my browser...Thank you for the help...Very much appreciated

sunnydt

#10
Hi, I had the remember me plugin working a while back and now it isnt working anymore for some reason. I cannot figure it out. Can someone help me please?

It is installed and I have this:

// List of active plugins (in plugins/ directory)
$rcmail_config['plugins'] = array('password', 'settings', 'sendmessage', 'checked_identities', 'http_authentication', 'markasjunk', 'markasjunk2', 'savepassword', 'accounts', 'remember_me', 'sound_notifier');

Vlad

Quote from: sunnydt;32431Hi, I had the remember me plugin working a while back and now it isnt working anymore for some reason. I cannot figure it out. Can someone help me please?

It is installed and I have this:

// List of active plugins (in plugins/ directory)
$rcmail_config['plugins'] = array('password', 'settings', 'sendmessage', 'checked_identities', 'http_authentication', 'markasjunk', 'markasjunk2', 'savepassword', 'accounts', 'remember_me', 'sound_notifier');

What are your timezone settings in PHP? I had similar problem with remember_me stopped working, due to a bug with UTC+0 timezone. It was fixed in the latest release today.

sunnydt

Timezone Database    internal
Default timezone    America/Denver
where is the new release please?

sunnydt

It seems to be working now. I updated the remember_me plugin. But I have a new issue now. I have installed the groupvise skin and everything is working except for folders. I get a 5101 error when I click the folders option. It says the service is currently unavailable. Is there a fix for this?

rosali

Which Roundcube version? Which plugin version?

Did you update to Roundcube 5.0 stable? Maybe it is related to a Roundcube bug:

#1487686 (Logging in redirects to login form) ? Roundcube Webmail
Regards,
Rosali