$continue = false;
}
- if (OC_User::userExists($_POST['user']) && $continue) {
- $token = hash('sha256', OC_Util::generateRandomBytes(30).OC_Config::getValue('passwordsalt', ''));
- OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword',
+ if (\OC_User::userExists($_POST['user']) && $continue) {
- $token = hash('sha256', \OC_Util::generate_random_bytes(30).\OC_Config::getValue('passwordsalt', ''));
++ $token = hash('sha256', \OC_Util::generateRandomBytes(30).\OC_Config::getValue('passwordsalt', ''));
+ \OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword',
hash('sha256', $token)); // Hash the token again to prevent timing attacks
- $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
+ $email = \OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
if (!empty($email)) {
- $link = OC_Helper::linkToRoute('core_lostpassword_reset',
+ $link = \OC_Helper::linkToRoute('core_lostpassword_reset',
array('user' => $_POST['user'], 'token' => $token));
- $link = OC_Helper::makeURLAbsolute($link);
+ $link = \OC_Helper::makeURLAbsolute($link);
- $tmpl = new OC_Template('core/lostpassword', 'email');
+ $tmpl = new \OC_Template('core/lostpassword', 'email');
$tmpl->assign('link', $link, false);
$msg = $tmpl->fetchPage();
- $l = OC_L10N::get('core');
- $from = OCP\Util::getDefaultEmailAddress('lostpassword-noreply');
+ $l = \OC_L10N::get('core');
+ $from = \OCP\Util::getDefaultEmailAddress('lostpassword-noreply');
try {
- $defaults = new OC_Defaults();
- OC_Mail::send($email, $_POST['user'], $l->t('%s password reset', array($defaults->getName())), $msg, $from, $defaults->getName());
+ $defaults = new \OC_Defaults();
+ \OC_Mail::send($email, $_POST['user'], $l->t('%s password reset', array($defaults->getName())), $msg, $from, $defaults->getName());
} catch (Exception $e) {
- OC_Template::printErrorPage( 'A problem occurs during sending the e-mail please contact your administrator.');
+ \OC_Template::printErrorPage( 'A problem occurs during sending the e-mail please contact your administrator.');
}
self::displayLostPasswordPage(false, true);
} else {