Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: mattfox27 on September 21, 2010, 01:44:05 AM

Title: How to set remember_me plugin to be unchecked by default
Post by: mattfox27 on September 21, 2010, 01:44:05 AM
I have the remember me plugin and i would like it to be unchecked by default.
Title: How to set remember_me plugin to be unchecked by default
Post by: rosali on September 21, 2010, 06:24:17 AM
It is unchecked by default.
Title: How to set remember_me plugin to be unchecked by default
Post by: mattfox27 on September 21, 2010, 07:01:26 PM
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
 
Code: [Select]
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

Code: [Select]
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");
}
 
};
 
 
Title: How to set remember_me plugin to be unchecked by default
Post by: mattfox27 on September 21, 2010, 08:13:26 PM
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
Title: How to set remember_me plugin to be unchecked by default
Post by: K9Marc on September 21, 2010, 08:50:34 PM
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
Title: How to set remember_me plugin to be unchecked by default
Post by: mattfox27 on September 21, 2010, 10:04:31 PM
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
Title: How to set remember_me plugin to be unchecked by default
Post by: rosali on September 22, 2010, 01:38:52 AM
@ 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.
Title: How to set remember_me plugin to be unchecked by default
Post by: mattfox27 on September 22, 2010, 06:19:24 PM
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?
Title: How to set remember_me plugin to be unchecked by default
Post by: rosali on September 23, 2010, 01:32:14 AM
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.
Title: How to set remember_me plugin to be unchecked by default
Post by: mattfox27 on September 24, 2010, 04:43:36 PM
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
Title: remember me plugin
Post by: sunnydt on January 14, 2011, 10:01:37 AM
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');
Title: How to set remember_me plugin to be unchecked by default
Post by: Vlad on January 14, 2011, 10:43:51 AM
Quote from: sunnydt;32431
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');


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.
Title: How to set remember_me plugin to be unchecked by default
Post by: sunnydt on January 14, 2011, 11:31:46 AM
Timezone Database    internal
Default timezone    America/Denver
where is the new release please?
Title: How to set remember_me plugin to be unchecked by default
Post by: sunnydt on January 14, 2011, 12:52:08 PM
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?
Title: How to set remember_me plugin to be unchecked by default
Post by: rosali on January 15, 2011, 12:51:46 AM
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 (http://trac.roundcube.net/ticket/1487686)
Title: How to set remember_me plugin to be unchecked by default
Post by: rosali on January 15, 2011, 12:54:20 AM
Regarding groupvice:

The skin is not completely compatible with Roundcube v0.5 yet. The author has announced an update for this weekend. The 501 error is due to the fact that
some templates used by RC0.5 are missing in Groupvice.
Title: How to set remember_me plugin to be unchecked by default
Post by: Julius Caesar on January 15, 2011, 03:18:20 PM
Quote from: sunnydt;32436
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?


There is now an updated version available for download. Check my signature for the download link.