twofactorshowchallenge.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. /** @var \OCP\IL10N $l */
  8. /** @var array $_ */
  9. /** @var boolean $error */
  10. $error = $_['error'];
  11. /* @var $error_message string */
  12. $error_message = $_['error_message'];
  13. /* @var $provider OCP\Authentication\TwoFactorAuth\IProvider */
  14. $provider = $_['provider'];
  15. /* @var $template string */
  16. $template = $_['template'];
  17. ?>
  18. <div class="body-login-container update two-factor">
  19. <h2 class="two-factor-header"><?php p($provider->getDisplayName()); ?></h2>
  20. <?php if ($error): ?>
  21. <?php if ($error_message): ?>
  22. <p><strong><?php p($error_message); ?></strong></p>
  23. <?php else: ?>
  24. <p><strong><?php p($l->t('Error while validating your second factor')); ?></strong></p>
  25. <?php endif; ?>
  26. <?php endif; ?>
  27. <?php print_unescaped($template); ?>
  28. <?php if (!is_null($_['backupProvider'])): ?>
  29. <p>
  30. <a class="two-factor-secondary" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge',
  31. [
  32. 'challengeProviderId' => $_['backupProvider']->getId(),
  33. 'redirect_url' => $_['redirect_url'],
  34. ]
  35. )) ?>">
  36. <?php p($l->t('Use backup code')) ?>
  37. </a>
  38. </p>
  39. <?php endif; ?>
  40. <p><a class="two-factor-secondary" href="<?php print_unescaped($_['logout_url']); ?>">
  41. <?php p($l->t('Cancel login')) ?>
  42. </a></p>
  43. </div>