use wcf\system\style\StyleHandler;
use wcf\system\user\storage\UserStorageHandler;
use wcf\system\WCF;
-use wcf\util\exception\CryptoException;
use wcf\util\FileUtil;
use wcf\util\HeaderUtil;
use wcf\util\StringUtil;
'signature_secret'
]);
}
- catch (CryptoException $e) {
+ catch (\Throwable $e) {
// ignore, the secret will stay empty and crypto operations
// depending on it will fail
}
use wcf\system\exception\SystemException;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
-use wcf\util\exception\CryptoException;
/**
* Worker implementation for sending new passwords.
* @param UserEditor $userEditor
*/
protected function resetPassword(UserEditor $userEditor) {
- try {
- $lostPasswordKey = bin2hex(\random_bytes(20));
- $lastLostPasswordRequestTime = TIME_NOW;
- }
- catch (CryptoException $e) {
- $lostPasswordKey = null;
- $lastLostPasswordRequestTime = 0;
- }
+ $lostPasswordKey = bin2hex(\random_bytes(20));
+ $lastLostPasswordRequestTime = TIME_NOW;
$userAction = new UserAction([$userEditor], 'update', [
'data' => [
'password' => null,
* @deprecated Use \random_bytes() directly.
*/
public static function randomBytes($n) {
- return random_bytes($n);
+ return \random_bytes($n);
}
/**
throw new CryptoException("Cannot generate a secure random number, min and max are the same");
}
- return random_int($min, $max);
+ return \random_int($min, $max);
}
/**
* @return string
*/
public static function getRandomID() {
- return bin2hex(random_bytes(20));
+ return \bin2hex(\random_bytes(20));
}
/**
return sprintf(
'%04x%04x-%04x-%04x-%02x%02x-%04x%04x%04x',
// time_low
- random_int(0, 0xffff), random_int(0, 0xffff),
+ \random_int(0, 0xffff), \random_int(0, 0xffff),
// time_mid
- random_int(0, 0xffff),
+ \random_int(0, 0xffff),
// time_hi_and_version
- random_int(0, 0x0fff) | 0x4000,
+ \random_int(0, 0x0fff) | 0x4000,
// clock_seq_hi_and_res
- random_int(0, 0x3f) | 0x80,
+ \random_int(0, 0x3f) | 0x80,
// clock_seq_low
- random_int(0, 0xff),
+ \random_int(0, 0xff),
// node
- random_int(0, 0xffff), random_int(0, 0xffff), random_int(0, 0xffff)
+ \random_int(0, 0xffff), \random_int(0, 0xffff), \random_int(0, 0xffff)
);
}