public function initiatePasswordResetProcess($loginOrEmail, $newPassword)
{
$this->checkNewPassword($newPassword);
// 'anonymous' has no password and cannot be reset
if ($loginOrEmail === 'anonymous') {
throw new Exception(Piwik::translate('Login_InvalidUsernameEmail'));
}
// get the user's login
$user = $this->getUserInformation($loginOrEmail);
if ($user === null) {
throw new Exception(Piwik::translate('Login_InvalidUsernameEmail'));
}
$login = $user['login'];
$this->savePasswordResetInfo($login, $newPassword);
// ... send email with confirmation link
try {
$this->sendEmailConfirmationLink($user);
} catch (Exception $ex) {
// remove password reset info
$this->removePasswordResetInfo($login);
throw new Exception($ex->getMessage() . Piwik::translate('Login_ContactAdmin'));
}
}