Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function logout()
- {
- $id_user = $this->Auth->user('id');
- $user_change = $this->Users->get($id_user);
- $old_password = '123';
- $new_password = '321';
- if (strlen($old_password)) {
- $hasher = new DefaultPasswordHasher();
- $hasher->hash($value);
- }
- else{
- $this->Flash->success('Error clave');
- }
- debug($user_change);
- if ($hasher === $user_change->password) {
- $user_change->password = $new_password;
- if($this->Users->save($user_update))
- {
- $this->Flash->success('La clave a sido cambiada con exito.');
- }
- else
- {
- $this->Flash->success('La clave no ha podido ser cambiada.');
- }
- }
- else{
- $this->Flash->success('fallo la comparacion.');
- }
- $this->Flash->success('Has salido correctamente');
- return $this->redirect($this->Auth->logout());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement