Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (26 sloc) 1.59 KB

CakePHP RememberMe Component

Currently this is a very basic component that will handle a lot of cookie handling when dealing with autologins and CakePHP's Auth. The component takes in an array of the user's details and sets it into a cookie to use for future login attempts.


This component was written very quickly and requires a lot of code cleaning up, of which I will do soon. If you have any extra functions you would like just let me know and may consider integrating them in. Otherwise feel free to fork! Also this component may get renamed to BlueBoy after:


Install the plugin:

cd myapp
git clone git:// remember_me

Depending on which user controller you would like the RememberMe functions to work on, open up the controller and type in.

var $components = array('RememberMe.RememberMe');

In order to log a user in and set the cookie information you can use something like this in your login action in your controller:

function members_login() {
    if ($this->Auth->user()) {
        if (!empty($this->data)) {

Refresh Cookie Expiry Times

Keeping cookie expiry dates in relation to the user's last action can be done in the AppController using the checkUser method in RememberMe. For example you may like to place it in your AppController like:

function _rememberMember() {
    if ($this->params['action'] != 'members_logout') {
Jump to Line
Something went wrong with that request. Please try again.