I use a similar method to Edward's (or so i imagine after a quick
glance).
I have the "ticketing" side of things put into a general-purpose
model:
http://bin.cakephp.org/saved/44956
In your case you would need the following logical steps. Where are you
getting into trouble?
- Display registration form
- Save new User with a flag to mark it as disabled. (any logins and
other features should require an enabled user)
- Create an activation ticket and send the url to the user's email.
- Accept activations where you verify the ticket (and delete it) and
enable the relevant user.
Using "my" Ticket model, I create a new ticket like this:
$ticket = $this->Ticket->setTicket($this->params['controller'],
$theUser['User']['email']);
Then I email this link:
$link = 'http://'.$_SERVER['SERVER_NAME'].'/'.$this->params
['controller'].'/activate/'.$ticket;
In the "activate" action I then fetch the ticket and enable the user.
function activate($hash = null) {
$email = $this->Ticket->getTicket($this->params['controller'],
$hash)
...
$authUser = $this->User->findByEmail($email);
if ( is_array($authUser) ) {
// enable the user here
}else{
// oups no user, better delete the ticket since this should
not be able to happen
$this->Ticket->drop($hash);
}
}
On Apr 13, 9:43 pm, niki <ranga.nik
...@gmail.com> wrote:
> hello
> I have been trying out a way to send an email to the new user with a
> token on a submitting the user registration form and finally saving
> the user into the database when the token has been exicuted.
> This is excatly like the bakery.cakephp.org user registration system.
> So far the closest tutorial/code snippet I have found for the same is
> http://edwardawebb.com/programming/php-programming/cakephp/reset-lost...
> and a slightly outdated tutorial for the same in the bakery. I have
> been trying to modify them for my needs but have been unsuccessful so
> far. Any help or guidance with the same essp. in terms of tutorials or
> a basic way to achieve the goal will be great help.
> thanks