authpicker.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. style('core', 'login/authpicker');
  7. script('core', 'login/authpicker');
  8. /** @var array $_ */
  9. /** @var \OCP\IURLGenerator $urlGenerator */
  10. $urlGenerator = $_['urlGenerator'];
  11. ?>
  12. <div class="picker-window">
  13. <h2><?php p($l->t('Connect to your account')) ?></h2>
  14. <p class="info">
  15. <?php print_unescaped($l->t('Please log in before granting %1$s access to your %2$s account.', [
  16. '<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
  17. \OCP\Util::sanitizeHTML($_['instanceName'])
  18. ])) ?>
  19. </p>
  20. <div class="notecard warning">
  21. <h3><?php p($l->t('Security warning')) ?></h3>
  22. <p>
  23. <?php p($l->t('If you are not trying to set up a new device or app, someone is trying to trick you into granting them access to your data. In this case do not proceed and instead contact your system administrator.')) ?>
  24. </p>
  25. </div>
  26. <br/>
  27. <p id="redirect-link">
  28. <form id="login-form" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.grantPage', ['stateToken' => $_['stateToken'], 'user' => $_['user'], 'direct' => $_['direct'] ?? 0])) ?>" method="get">
  29. <input type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Log in')) ?>" disabled>
  30. </form>
  31. </p>
  32. <form action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.apptokenRedirect')); ?>" method="post" id="app-token-login-field" class="hidden">
  33. <p class="grouptop">
  34. <input type="text" name="user" id="user" placeholder="<?php p($l->t('Login')) ?>">
  35. <label for="user" class="infield"><?php p($l->t('Login')) ?></label>
  36. </p>
  37. <p class="groupbottom">
  38. <input type="password" name="password" id="password" placeholder="<?php p($l->t('App password')) ?>">
  39. <label for="password" class="infield"><?php p($l->t('Password')) ?></label>
  40. </p>
  41. <input type="hidden" name="stateToken" value="<?php p($_['stateToken']) ?>" />
  42. <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>">
  43. <input id="submit-app-token-login" type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Grant access')) ?>">
  44. </form>
  45. <?php if (empty($_['oauthState'])): ?>
  46. <a id="app-token-login" class="apptoken-link" href="#"><?php p($l->t('Alternative log in using app password')) ?></a>
  47. <?php endif; ?>
  48. </div>