Skip to content

Instantly share code, notes, and snippets.

@waspinator
Created September 25, 2015 20:15
Show Gist options
  • Save waspinator/362a74c53d95950cbf4c to your computer and use it in GitHub Desktop.
Save waspinator/362a74c53d95950cbf4c to your computer and use it in GitHub Desktop.
public function password($id = null)
{
$user = $this->Users->get($id);
if ($this->request->is(['patch', 'post', 'put'])) {
$user = $this->Users->patchEntity($user, $this->request->data);
if ($this->request->is(['ajax'])) {
if ($this->Users->save($user)) {
} else {
}
} else {
if ($this->Users->save($user)) {
$this->Flash->success('The user has been saved.');
} else {
debug($user); die;
$this->Flash->error('The user could not be saved. Please, try again.');
}
}
}
$this->set(compact('user'));
$this->set('_serialize', ['user']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment