Skip to content

Instantly share code, notes, and snippets.

@stevencwarren
Created September 13, 2010 21:04
Show Gist options
  • Save stevencwarren/578053 to your computer and use it in GitHub Desktop.
Save stevencwarren/578053 to your computer and use it in GitHub Desktop.
$email = $request->getParameter('email');
$user = Doctrine_Core::getTable('User')->getUser($email);
if($user)
{
$validchars = array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','f','g','h','j','k','m','n','p','q','r','s','t','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U',"V",'W','X','Y',"Z");
$password = '';
$i = 0;
while ($i < 8) {
$password .= $validchars[rand(0, count($validchars) - 1)];
$i++;
}
$user->password = md5($password);
$user->save();
$external_user = Doctrine_Core::getTable('UserSource')->saveExternalPasswords($user, $password);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment