Monday, May 21, 2012

V2.1.2 Email Verification after registration

Okay, been working on this for a while, but I cannot figure out what
in the world is going on!

public function valid() {
if (!empty($this->passedArgs[0]) && !empty($this-
>passedArgs[1])){
$username = $this->passedArgs[0];
$validation = $this->passedArgs[1];
$results = $this->User->find(null, array('conditions' =>
array('User.username' => $this->passedArgs[0])));
if ($results['User']['usertype'] == 'valid') {
if($results['User']['validation'] == $validation) {
$results['User']['validation'] = md5(uniqid());
$results['User']['usertype'] = 'user';
$this->User->save($results);
$this->Session->setFlash('Your registration is
complete');
$this->redirect(array('action' => 'login'));
} else {
$this->Session->setFlash(__('The validation code
does not match this users validation code. Please check your email
and make sure you copied it correctly.'));
$this->redirect(array('action' => 'login'));
}
} else {
$this->Session->setFlash(__('This user has already
been activated, please login to continue.'));
$this->redirect(array('action' => 'login'));
}
}
}

There is no view, it's supposed to just go through the controller and
redirect. If I could figure out how to retrieve the auto_increment
user ID when the user is registered and send it in the auto generated
email I wouldn't have this problem, or if I could retrieve the data
based on the username. The SQL dump comes up properly formatted calls
everything as I want, but all the data retrieved comes up null. Well,
not exactly null, it somehow gets the proper user ID for all
associated models... but no data is brought up to check and therefore
fails the check for "valid" as usertype... So, if someone could tell
me what is wrong with my formatting I would be most grateful! Thank
you in advance for any tips :-D

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: