Changeset 3580 for trunk/modules/auth

Show
Ignore:
Timestamp:
10/10/2008 03:55:50 PM (8 weeks ago)
Author:
Shadowhand
Message:

Follow up to r3578

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/auth/classes/model/auth/user.php

    r3578 r3580  
    6060                if ($array->validate()) 
    6161                { 
    62                         if ($this->find($array['username']) AND Auth::instance()->login($this, $array['password'])) 
     62                        // Attempt to load the user 
     63                        $this->find($array['username']); 
     64 
     65                        if ($this->loaded AND Auth::instance()->login($this, $array['password'])) 
    6366                        { 
    6467                                if (is_string($redirect)) 
     
    7477                        { 
    7578                                $array->add_error('username', 'invalid'); 
     79                        } 
     80                } 
     81 
     82                return $status; 
     83        } 
     84 
     85        /** 
     86         * Validates an array for a matching password and password_confirm field. 
     87         * 
     88         * @param  array    values to check 
     89         * @param  string   save the user if 
     90         * @return boolean 
     91         */ 
     92        public function change_password(array & $array, $save = FALSE) 
     93        { 
     94                $array = Validation::factory($array) 
     95                        ->pre_filter('trim') 
     96                        ->add_rules('password', 'required', 'length[5,127]') 
     97                        ->add_rules('password_confirm', 'matches[password]'); 
     98 
     99                if ($status = $array->validate()) 
     100                { 
     101                        // Change the password 
     102                        $this->password = $array['password']; 
     103 
     104                        if ($save == TRUE AND $status = $this->save()) 
     105                        { 
     106                                if (is_string($save)) 
     107                                { 
     108                                        // Redirect to the success page 
     109                                        url::redirect($save); 
     110                                } 
    76111                        } 
    77112                }