php - CakePHP First login -


i'm busy time login system in cakephp.

have website people can join , login. want if users login first time user has proceed steps information must completed.

thinking create in database field active 1 or 0. when user proceed steps profile has been activated , never show's first time logged in page.

such welcome 'user', profile information -> connect -> information application
-> activate account

can give me snippets this.

many thanks!

  <?php      class userscontroller extends appcontroller {          var $name = 'users';          function beforefilter() {             parent::beforefilter();              // rights admin users              $this->auth->mapactions(                 array(                     'create' => array('admin_add'),                     'read' => array('index', 'admin_index')                 )             );              // can login             $this->auth->allow(array('login'));              // apply ucfirst (capital) & strolower (small text) username             if (isset($this->data['user']['username'])) {                 $this->data['user']['username'] = ucfirst(strtolower($this->data['user']['username']));              }          }          function login() {              // check if user logged in correctly, update date/time login             if ($this->auth->user()) {                  // update login date                 $this->user->save(array(                     'id' => $this->session->read('auth.user.id'),                     'last_login' => date('y-m-d h:i:s')                 ));                   // group name                 $group = $this->user->group->findbyid($this->session->read('auth.user.group_id'));                   // set redirect if user has logged in administrator                 if ($group['group']['name'] == 'admins') {                      $this->redirect(array('controller' => 'posts', 'action' => 'index'));                 }             }               // redirect user homepage      //      $this->redirect(array('controller' => '', 'action' => ''));               pr($this->session->read('auth'));          }           function logout() {             $this->redirect($this->auth->logout());         }          function admin_index() {             echo 'it work's';         }    

use active field when have completed welcome process. however, need track each step of process well. if got page 2 of process , computer shuts off?

i have table tracks progress. each step added new user completes it. when steps complete, update active field in record in user table (indicating completed steps) , remove progress information table tracks it.

the next time user logs in, see have active flag set, , skip welcome process. however, if got partway through, active field still reflect 0 , progress table tell right left off.


Comments