1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

Add backup codes

This commit is contained in:
Jeremy Benoist 2018-12-03 06:51:06 +01:00
parent 6e4fc956ab
commit dfd0a7bc5f
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
21 changed files with 97 additions and 15 deletions

View file

@ -2,6 +2,7 @@
namespace Wallabag\CoreBundle\Controller;
use PragmaRX\Recovery\Recovery as BackupCodes;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
@ -93,10 +94,12 @@ class ConfigController extends Controller
$user->setGoogleAuthenticatorSecret($secret);
$user->setEmailTwoFactor(false);
$user->setBackupCodes((new BackupCodes())->toArray());
$this->addFlash('OtpQrCode', $this->get('scheb_two_factor.security.google_authenticator')->getQRContent($user));
} elseif (false === $userForm->get('googleTwoFactor')->getData() && true === $user->isGoogleAuthenticatorEnabled()) {
$user->setGoogleAuthenticatorSecret(null);
$user->setBackupCodes(null);
}
}