publicshareauth.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. /** @var array $_ */
  7. /** @var \OCP\IL10N $l */
  8. \OCP\Util::addStyle('core', 'guest');
  9. \OCP\Util::addStyle('core', 'publicshareauth');
  10. \OCP\Util::addScript('core', 'publicshareauth');
  11. ?>
  12. <div class="guest-box">
  13. <!-- password prompt form. It should be hidden when we show the email prompt form -->
  14. <?php if (!isset($_['identityOk'])): ?>
  15. <form method="post" id="password-input-form">
  16. <?php else: ?>
  17. <form method="post" id="password-input-form" style="display:none;">
  18. <?php endif; ?>
  19. <fieldset class="warning">
  20. <?php if (!isset($_['wrongpw'])): ?>
  21. <div class="warning-info"><?php p($l->t('This share is password-protected')); ?></div>
  22. <?php endif; ?>
  23. <?php if (isset($_['wrongpw'])): ?>
  24. <div class="warning wrongPasswordMsg"><?php p($l->t('The password is wrong or expired. Please try again or request a new one.')); ?></div>
  25. <?php endif; ?>
  26. <p>
  27. <label for="password" class="infield"><?php p($l->t('Password')); ?></label>
  28. <input type="hidden" id="requesttoken" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
  29. <input type="password" name="password" id="password"
  30. placeholder="<?php p($l->t('Password')); ?>" value=""
  31. autocomplete="new-password" autocapitalize="off" spellcheck="false"
  32. autofocus />
  33. <input type="hidden" name="sharingToken" value="<?php p($_['share']->getToken()) ?>" id="sharingToken">
  34. <input type="hidden" name="sharingType" value="<?php p($_['share']->getShareType()) ?>" id="sharingType">
  35. <input type="submit" id="password-submit"
  36. class="svg icon-confirm input-button-inline" value="" disabled="disabled" />
  37. </p>
  38. </fieldset>
  39. </form>
  40. <!-- email prompt form. It should initially be hidden -->
  41. <?php if (isset($_['identityOk'])): ?>
  42. <form method="post" id="email-input-form">
  43. <?php else: ?>
  44. <form method="post" id="email-input-form" style="display:none;">
  45. <?php endif; ?>
  46. <fieldset class="warning">
  47. <div class="warning-info" id="email-prompt"><?php p($l->t('Please type in your email address to request a temporary password')); ?></div>
  48. <p>
  49. <input type="email" id="email" name="identityToken" placeholder="<?php p($l->t('Email address')); ?>" />
  50. <input type="submit" id="password-request" name="passwordRequest" class="svg icon-confirm input-button-inline" value="" disabled="disabled"/>
  51. <input type="hidden" id="requesttoken" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
  52. <input type="hidden" name="sharingToken" value="<?php p($_['share']->getToken()) ?>" id="sharingToken">
  53. <input type="hidden" name="sharingType" value="<?php p($_['share']->getShareType()) ?>" id="sharingType">
  54. </p>
  55. <?php if (isset($_['identityOk'])): ?>
  56. <?php if ($_['identityOk']): ?>
  57. <div class="warning-info" id="identification-success"><?php p($l->t('Password sent!')); ?></div>
  58. <?php else: ?>
  59. <div class="warning" id="identification-failure"><?php p($l->t('You are not authorized to request a password for this share')); ?></div>
  60. <?php endif; ?>
  61. <?php endif; ?>
  62. </fieldset>
  63. </form>
  64. <!-- request password button -->
  65. <?php if (!isset($_['identityOk']) && $_['share']->getShareType() === $_['share']::TYPE_EMAIL && !$_['share']->getSendPasswordByTalk()): ?>
  66. <a id="request-password-button-not-talk"><?php p($l->t('Forgot password?')); ?></a>
  67. <?php endif; ?>
  68. <!-- back to showShare button -->
  69. <form method="get">
  70. <fieldset>
  71. <a
  72. href=""
  73. id="request-password-back-button"
  74. <?php if (isset($_['identityOk'])): ?>
  75. style="display:block;">
  76. <?php else: ?>
  77. style="display:none;">
  78. <?php endif; ?>
  79. <?php p($l->t('Back')); ?></a>
  80. </fieldset>
  81. </form>
  82. </div>