Merge pull request #17628 from nextcloud/enh/14811/2fa_backup_chars

Only human readbale backup chars
This commit is contained in:
Roeland Jago Douma 2019-10-22 15:40:38 +02:00 committed by GitHub
commit 6be518c642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -72,7 +72,7 @@ class BackupCodeStorage {
$uid = $user->getUID();
foreach (range(1, min([$number, 20])) as $i) {
$code = $this->random->generate(self::$CODE_LENGTH, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS);
$code = $this->random->generate(self::$CODE_LENGTH, ISecureRandom::CHAR_HUMAN_READABLE);
$dbCode = new BackupCode();
$dbCode->setUserId($uid);

View File

@ -67,7 +67,7 @@ class BackupCodeStorageTest extends TestCase {
$user->method('getUID')->willReturn('fritz');
$this->random->expects($this->exactly($number))
->method('generate')
->with(16, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
->with(16, ISecureRandom::CHAR_HUMAN_READABLE)
->will($this->returnValue('CODEABCDEF'));
$this->hasher->expects($this->exactly($number))
->method('hash')