Thursday, September 27, 2012

Re: function beforeFilter

Stupid me. What a bad idea. I have SO much to learn! ;-)

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 27 Sep 2012, at 10:16:01, euromark <dereuromark@gmail.com> wrote:

jeremy: that would not only be too easy, it would also reduce the method to zero lines and make it removable alltogether
clearly not a good idea ;)

gosh I just saw too much Southpark S16E08 and Sarcastaball..^^



Am Mittwoch, 26. September 2012 14:45:34 UTC+2 schrieb Jeremy Burns:
Why not replace all of that with the Auth component?

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 26 Sep 2012, at 13:38:22, Chris <chri...@yahoo.com> wrote:

hi euromark,... I have try: 
          // loadModel('user');
  App::import('Model', 'User');
          
still not working...

On Wednesday, September 26, 2012 5:32:25 AM UTC-7, euromark wrote:
maybe its the ancient loadModel() function?


Am Mittwoch, 26. September 2012 14:26:23 UTC+2 schrieb Chris:
hi Jeremy,... can't access the site (secure area) with username and password,... loosing session I think,... can't read user,... and   function beforeFilter()  is in a app-controller.php with settings 

  var $helpers = array('Html', 'Form', 'Time', 'Text', 'Javascript', 'Ajax', 'Session', 'Application', 'User', 'PhotoShow');  
    var $components = array('Cookie', 'RequestHandler', 'Session');
  


On Wednesday, September 26, 2012 5:10:17 AM UTC-7, Chris wrote:
function beforeFilter working on a 1.2,... trying to migrate whole script to 1.3,... 
having problem,... what can be wrong,... ??? please help,... thanks 

  
  function beforeFilter()
  {
    if($this->Session->check('user'))
      $this->user = $this->Session->read('user');
    
    if(!$this->is_user())
    {
      $username = $this->Cookie->read('User.username');
      $hashed_password = $this->Cookie->read('User.hashed_password');
      
      if($username && $hashed_password)
      {
        if(!class_exists('User'))
          loadModel('user');
          
        $User = new User();
        
        if($user = $User->findByUsernameAndHashedPassword($username, $hashed_password))
        {
          $this->Session->write('user', array('id' => $user['User']['id'], 'username' => $user['User']['username'], 'rank' => $user['User']['rank'], 'gender' => $user['User']['gender'], 'firstname' => $user['User']['firstname'], 'lastname' => $user['User']['lastname']));
          $this->set_language($user['User']['language']);
          if($this->Session->check('user'))
            $this->user = $this->Session->read('user');
        }
      }
    }
    



--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 


--
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: