I even moved all the code into the Model, did what you said, and its
still doing an insert instead of an update. Heres the method I call in
the controller:

function verifyEmailExpiration($username, $password, $hash, $expHours)
{
        $userObj = $this->find('first', array(
                'conditions' => array(
                        'User.username' => $username,
                        'User.password' => $password,
                        'User.hash' => $hash
                ),
                'fields' => array('User.id', 'User.signupDate', 'User.status')
        ));

        if (!empty($userObj)) {
                $this->create();
                $this->id = $userObj['User']['id'];

                // Get timeframe
                $signupTime = strtotime('+'. $expHours .' days', 
$userObj['User']
['signupDate']);
                $currentTime = time();

                if ($userObj['User']['status'] == 'active') {
                        $this->invalidate('', 'alreadyVerified');
                        return false;

                } else if ($currentTime < $signupTime) {
                        $this->saveField('status', 'active');
                        return true;

                } else {
                        $this->saveField('status', 'inactive');
                        $this->invalidate('', 'verifyTimeElapsed', 
array($expHours));
                        return false;
                }
        } else {
                $this->invalidate('', 'verifyFailure');
        }

        return false;
}

Also I thought models by default didnt inherit the locale stuff, is
the app_model an exception?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to