1
0

twofactorselectchallenge.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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-only
  6. */
  7. $noProviders = empty($_['providers']);
  8. ?>
  9. <div class="body-login-container update two-factor">
  10. <h2 class="two-factor-header"><?php p($l->t('Two-factor authentication')) ?></h2>
  11. <?php if (!$noProviders): ?>
  12. <p><?php p($l->t('Enhanced security is enabled for your account. Choose a second factor for authentication:')) ?></p>
  13. <?php endif ?>
  14. <?php if ($_['providerMissing']): ?>
  15. <p>
  16. <strong><?php p($l->t('Could not load at least one of your enabled two-factor auth methods. Please contact your admin.')) ?></strong>
  17. </p>
  18. <?php endif; ?>
  19. <?php if ($noProviders): ?>
  20. <img class="two-factor-icon" src="<?php p(image_path('core', 'actions/password-white.svg')) ?>" alt="" />
  21. <p>
  22. <?php if (is_null($_['backupProvider'])): ?>
  23. <?php if (!$_['hasSetupProviders']) { ?>
  24. <strong><?php p($l->t('Two-factor authentication is enforced but has not been configured on your account. Contact your admin for assistance.')) ?></strong>
  25. <?php } else { ?>
  26. <strong><?php p($l->t('Two-factor authentication is enforced but has not been configured on your account. Please continue to setup two-factor authentication.')) ?></strong>
  27. <a class="button primary two-factor-primary" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.setupProviders',
  28. [
  29. 'redirect_url' => $_['redirect_url'],
  30. ]
  31. )) ?>">
  32. <?php p($l->t('Set up two-factor authentication')) ?>
  33. </a>
  34. <?php } ?>
  35. <?php else: ?>
  36. <strong><?php p($l->t('Two-factor authentication is enforced but has not been configured on your account. Use one of your backup codes to log in or contact your admin for assistance.')) ?></strong>
  37. <?php endif; ?>
  38. </p>
  39. <?php else: ?>
  40. <ul>
  41. <?php foreach ($_['providers'] as $provider): ?>
  42. <li>
  43. <a class="two-factor-provider"
  44. href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge',
  45. [
  46. 'challengeProviderId' => $provider->getId(),
  47. 'redirect_url' => $_['redirect_url'],
  48. ]
  49. )) ?>">
  50. <?php
  51. if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) {
  52. $icon = $provider->getLightIcon();
  53. } else {
  54. $icon = image_path('core', 'actions/password-white.svg');
  55. }
  56. ?>
  57. <img src="<?php p($icon) ?>" alt="" />
  58. <div>
  59. <h3><?php p($provider->getDisplayName()) ?></h3>
  60. <p><?php p($provider->getDescription()) ?></p>
  61. </div>
  62. </a>
  63. </li>
  64. <?php endforeach; ?>
  65. </ul>
  66. <?php endif ?>
  67. <?php if (!is_null($_['backupProvider'])): ?>
  68. <p>
  69. <a class="<?php if ($noProviders): ?>button primary two-factor-primary<?php else: ?>two-factor-secondary<?php endif ?>" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge',
  70. [
  71. 'challengeProviderId' => $_['backupProvider']->getId(),
  72. 'redirect_url' => $_['redirect_url'],
  73. ]
  74. )) ?>">
  75. <?php p($l->t('Use backup code')) ?>
  76. </a>
  77. </p>
  78. <?php endif; ?>
  79. <p><a class="two-factor-secondary" href="<?php print_unescaped($_['logout_url']); ?>">
  80. <?php p($l->t('Cancel login')) ?>
  81. </a></p>
  82. </div>