php - how to send session's content to a remember me cookie? -


i working on remember me cookie in cakephp keeps logged in 2 weeks.

it working fine, passing written onto cookie:

$this->request->data['user']['username'] 

whenever new user registered, hashed id created default.

the remember me cookie generates key checks if same user , logins in backgroud. when cookie created cakephp expires (default being 4 hours), information such user id, address, etc lost.

how send id checked instead?

how store of those(user info) after 4 hours? (say around 2 weeks)

change login function this

 function login() {     if ($this->auth->user()) {         if (!empty($this->data['user']['remember_me'])) {             $cookie = array();             $cookie['username'] = $this->data['user']['username'];             $cookie['password'] = $this->data['user']['password'];             $this->cookie->write('auth.user', $cookie, true, '+2 weeks');             unset($this->data['user']['remember_me']);         }         $this->redirect($this->auth->redirect());     }     if (empty($this->data)) {         $cookie = $this->cookie->read('auth.user');         if (!is_null($cookie)) {             if ($this->auth->login($cookie)) {                 //  clear auth message, in case use it.                 $this->session->delete('message.auth');                 $this->redirect($this->auth->redirect());             }         }     } } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -