diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-01-17 12:30:47 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-01-29 22:21:54 +0100 |
commit | f30877ea7c758346b700e4ac0f9c684a5ae99c7f (patch) | |
tree | ffbdd342c3bcc42d08d7315e78dc3075fe93a2b9 /apps/twofactor_backupcodes/lib/Provider | |
parent | 139055c1ddec25465dd7644de9866cd6a1048da2 (diff) | |
download | nextcloud-server-f30877ea7c758346b700e4ac0f9c684a5ae99c7f.tar.gz nextcloud-server-f30877ea7c758346b700e4ac0f9c684a5ae99c7f.zip |
Provide initial state
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/twofactor_backupcodes/lib/Provider')
-rw-r--r-- | apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php b/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php index 807371907db..8910665f321 100644 --- a/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php +++ b/apps/twofactor_backupcodes/lib/Provider/BackupCodesProvider.php @@ -29,6 +29,7 @@ use OCA\TwoFactorBackupCodes\Settings\Personal; use OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings; use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings; +use OCP\IInitialStateService; use OCP\IL10N; use OCP\IUser; use OCP\Template; @@ -46,6 +47,8 @@ class BackupCodesProvider implements IProvider, IProvidesPersonalSettings { /** @var AppManager */ private $appManager; + /** @var IInitialStateService */ + private $initialStateService; /** * @param string $appName @@ -53,11 +56,16 @@ class BackupCodesProvider implements IProvider, IProvidesPersonalSettings { * @param IL10N $l10n * @param AppManager $appManager */ - public function __construct(string $appName, BackupCodeStorage $storage, IL10N $l10n, AppManager $appManager) { + public function __construct(string $appName, + BackupCodeStorage $storage, + IL10N $l10n, + AppManager $appManager, + IInitialStateService $initialStateService) { $this->appName = $appName; $this->l10n = $l10n; $this->storage = $storage; $this->appManager = $appManager; + $this->initialStateService = $initialStateService; } /** @@ -149,7 +157,8 @@ class BackupCodesProvider implements IProvider, IProvidesPersonalSettings { */ public function getPersonalSettings(IUser $user): IPersonalProviderSettings { $state = $this->storage->getBackupCodesState($user); - return new Personal(base64_encode(json_encode($state))); + $this->initialStateService->provideInitialState($this->appName, $state); + return new Personal(); } } |