I'm still stuck on this same issue because I don't know how to
properly create an object. The custom controller I created doesn't
seem to cut it. Since I've been stuck on this for days any help would
be greatly appreciated!! Thanks!

/* My custom controller: */

App::import(array('Router', 'Security'));

class ScupAuthComponent extends Object {
        function initialize(&$controller) {
                $this->controller =& $controller;
        }

        function hashPasswords($data) {
                if (isset($data[$this->controller->Auth->userModel])) {
                        if 
(isset($data[$this->controller->Auth->userModel][$this-
>controller->Auth->fields['username']]) && isset($data[$this-
>controller->Auth->userModel][$this->controller->Auth-
>fields['password']])) {
                                
$data[$this->controller->Auth->userModel][$this->controller->Auth-
>fields['password']] = $this->password($data[$this->controller->Auth-
>userModel][$this->controller->Auth->fields['password']]);
                        }
                }
        }

        function password($password) {
                return Security::hash($password, null, false);
        }
}

/* The app controller: */

class AppController extends Controller {
        var $components = array('Auth', 'ScupAuth');
        function beforeFilter() {
                Security::setHash('md5');
                $this->Auth->userModel = 'Person';
                $this->Auth->fields = array(
                        'username' => 'email',
                        'password' => 'password'
                        );
                $this->Auth->authorize = $this->ScupAuth;
                $this->Auth->loginAction = array('controller' => 'people', 
'action'
=> 'login');
                $this->Auth->loginRedirect = '/';
        }
}

On Sep 14, 10:08 pm, "Yodi Aditya" <[EMAIL PROTECTED]> wrote:
> I have read about auth component inhttp://manual.cakephp.org.
> then, i found this :
>
> " The Security class uses a salt value (set in /app/config/core.php) to
> encrypt the password. If you have an existing database that previously used
> an encryption scheme without a salt, set
> authorize<http://manual.cakephp.org/view/566/view/396/authorize>if not
> already set, and create the method
> password <http://manual.cakephp.org/view/386/password> in the class you
> nominate. "
>
> Whew... hope it's help someone that have same problem with me :D
>
> On 9/12/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to