Created
January 20, 2015 22:39
-
-
Save rfos/b46a0edcbddc31a0035d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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