twofactorselectchallenge.php 3.0 KB

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