forked from D3Public/oxtotp
change random string library because of deprecated code in old one
This commit is contained in:
parent
2fb7e63788
commit
d20322867d
@ -35,7 +35,7 @@
|
||||
"oxid-esales/oxideshop-metapackage-ce": "~6.0.3 || ~6.1.0",
|
||||
"spomky-labs/otphp": "^8.3",
|
||||
"bacon/bacon-qr-code": "^1.0",
|
||||
"ircmaxell/random-lib": "^1.2"
|
||||
"zendframework/zend-math": "^3.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
27
src/Application/Model/d3RandomGenerator.php
Normal file
27
src/Application/Model/d3RandomGenerator.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace D3\Totp\Application\Model;
|
||||
|
||||
use Zend\Math\Rand;
|
||||
|
||||
class d3RandomGenerator extends Rand
|
||||
{
|
||||
const CHAR_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const CHAR_LOWER = 'abcdefghijklmnopqrstuvwxyz';
|
||||
const CHAR_DIGITS = '0123456789';
|
||||
const CHAR_UPPER_HEX = 'ABCDEF';
|
||||
const CHAR_LOWER_HEX = 'abcdef';
|
||||
const CHAR_BASE64 = '+/';
|
||||
const CHAR_SYMBOLS = '!"#$%&\'()* +,-./:;<=>?@[\]^_`{|}~';
|
||||
const CHAR_BRACKETS = '()[]{}<>';
|
||||
const CHAR_PUNCT = ',.;:';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getRandomTotpBackupCode()
|
||||
{
|
||||
return self::getString(6, self::CHAR_DIGITS);
|
||||
}
|
||||
}
|
@ -34,10 +34,8 @@ class d3backupcode extends BaseModel
|
||||
*/
|
||||
public function generateCode($sUserId)
|
||||
{
|
||||
$factory = new Factory();
|
||||
$generator = $factory->getLowStrengthGenerator();
|
||||
$sCode = d3RandomGenerator::getRandomTotpBackupCode();
|
||||
|
||||
$sCode = $generator->generateString(6, Generator::CHAR_DIGITS);
|
||||
$this->assign(
|
||||
[
|
||||
'oxuserid' => $sUserId,
|
||||
|
Loading…
x
Reference in New Issue
Block a user