+ $this->emailTwoFactor = $emailTwoFactor;
+ }
+
+ /**
+ * Used in the user config form to be "like" the email option.
+ */
+ public function isGoogleTwoFactor()
+ {
+ return $this->isGoogleAuthenticatorEnabled();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isEmailAuthEnabled(): bool
+ {
+ return $this->emailTwoFactor;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getEmailAuthCode(): string
+ {
+ return $this->authCode;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setEmailAuthCode(string $authCode): void
+ {
+ $this->authCode = $authCode;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getEmailAuthRecipient(): string
+ {
+ return $this->email;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isGoogleAuthenticatorEnabled(): bool
+ {
+ return $this->googleAuthenticatorSecret ? true : false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getGoogleAuthenticatorUsername(): string
+ {
+ return $this->username;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getGoogleAuthenticatorSecret(): string
+ {
+ return $this->googleAuthenticatorSecret;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setGoogleAuthenticatorSecret(?string $googleAuthenticatorSecret): void
+ {
+ $this->googleAuthenticatorSecret = $googleAuthenticatorSecret;
+ }
+
+ public function setBackupCodes(array $codes = null)
+ {
+ $this->backupCodes = $codes;
+ }
+
+ public function getBackupCodes()
+ {
+ return $this->backupCodes;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isBackupCode(string $code): bool
+ {
+ return false === $this->findBackupCode($code) ? false : true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function invalidateBackupCode(string $code): void
+ {
+ $key = $this->findBackupCode($code);
+
+ if (false !== $key) {
+ unset($this->backupCodes[$key]);
+ }