Skip to content

Instantly share code, notes, and snippets.

@tobiastom
Created September 13, 2009 15:51
Show Gist options
  • Select an option

  • Save tobiastom/186218 to your computer and use it in GitHub Desktop.

Select an option

Save tobiastom/186218 to your computer and use it in GitHub Desktop.
public function generatePasswordAction($identifier, $sendByEmail = false) {
$this->user = \User\User::instanceWithId($identifier);
if (!$this->user) {
return self::NotFoundStatus;
}
if ($this->request->isConfirmed()) {
$this->user->password = $this->password = \User\User::generateRandomPassword();
$this->user->save();
$this->response->layoutVariant = 'Successful';
return self::AcceptedStatus;
}
return self::SuccessStatus;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment