public function resetPassword($requestedPassword = null, $oldPassword = null) { if ($requestedPassword && !$this->isPasswordValid($oldPassword)) { return null; } if ($requestedPassword) { $newPassword = $requestedPassword; } else { $newPassword = adminKuserPeer::generateNewPassword(); } $this->setPassword($newPassword); if ($requestedPassword) { $this->addToPreviousPasswords($this->getSha1Password(), $this->getSalt()); } $this->setPasswordHashKey($this->newPassHashKey()); $this->setLoginAttempts(0); $this->setLoginBlockedUntil(null); $this->save(); return $newPassword; }