Skip to content

Instantly share code, notes, and snippets.

@rfos
Created January 20, 2015 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rfos/b46a0edcbddc31a0035d to your computer and use it in GitHub Desktop.
Save rfos/b46a0edcbddc31a0035d to your computer and use it in GitHub Desktop.
public function validarEmail($id,$codigo)
{
$count = $this->User->find('count', array('conditions' => array('User.id =' => $id,'User.codigo =' => $codigo)));
if($count)
{
$this->User->id = $id;
$this->User->set('status','1');
$this->User->set('ativacao','1');
$this->User->set('codigo','0');
$data = $this->User->save();
if($this->Auth->login($data['User']))
{
$this->Session->setFlash(
'<p><strong>Seja bem vindo, '.Inflector::humanize(AuthComponent::user('nome')).'!<br><br></strong></p>',
'default',
array('titulo' => 'Login efetuado com sucesso!','class' => 'alert alert-success'),'auth');
$this->redirect(array('controller' => 'videos', 'action' => ''));
}
}
else
{
$this->Session->setFlash(
'<p><strong>Link informado já foi utilizado ou está incorreto.</strong></p>',
'default',
array(
'titulo' => 'Cadastro realizado com sucesso!',
'class' => 'alert alert-warning'
)
);
$this->redirect(array('controller' => 'Inicio', 'action' => 'index'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment