aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/settings/src/admin.js15
-rw-r--r--apps/settings/templates/settings/admin/sharing.php6
2 files changed, 20 insertions, 1 deletions
diff --git a/apps/settings/src/admin.js b/apps/settings/src/admin.js
index 665f553bfbc..3bbfb564763 100644
--- a/apps/settings/src/admin.js
+++ b/apps/settings/src/admin.js
@@ -46,6 +46,21 @@ window.addEventListener('DOMContentLoaded', () => {
$('#setDefaultRemoteExpireDate').toggleClass('hidden', !this.checked)
})
+ $('#enableLinkPasswordByDefault').change(function() {
+ if (this.checked) {
+ $('#enforceLinkPassword').removeAttr('disabled')
+ $('#passwordsExcludedGroups').removeAttr('disabled')
+ } else {
+ $('#enforceLinkPassword').attr('disabled', '')
+ $('#passwordsExcludedGroups').attr('disabled', '')
+
+ // Uncheck "Enforce password protection" when "Always asks for a
+ // password" is unchecked; the change event needs to be explicitly
+ // triggered so it behaves like a change done by the user.
+ $('#enforceLinkPassword').removeAttr('checked').trigger('change')
+ }
+ })
+
$('#enforceLinkPassword').change(function() {
$('#selectPasswordsExcludedGroups').toggleClass('hidden', !this.checked)
})
diff --git a/apps/settings/templates/settings/admin/sharing.php b/apps/settings/templates/settings/admin/sharing.php
index 1a943197a8a..2918a764d89 100644
--- a/apps/settings/templates/settings/admin/sharing.php
+++ b/apps/settings/templates/settings/admin/sharing.php
@@ -117,6 +117,8 @@
<input type="checkbox" name="shareapi_enforce_links_password" id="enforceLinkPassword" class="checkbox"
value="1" <?php if ($_['enforceLinkPassword']) {
print_unescaped('checked="checked"');
+} ?> <?php if ($_['enableLinkPasswordByDefault'] !== 'yes') {
+ print_unescaped('disabled');
} ?> />
<label for="enforceLinkPassword" class="indent"><?php p($l->t('Enforce password protection'));?></label><br/>
@@ -124,7 +126,9 @@
<span id="selectPasswordsExcludedGroups" class="double-indent <?php if (!$_['enforceLinkPassword']) { p('hidden'); } ?>">
<label for="shareapi_enforce_links_password_excluded_groups"><?php p($l->t('Exclude groups from password requirements:'));?></label><br/>
<input name="shareapi_enforce_links_password_excluded_groups" id="passwordsExcludedGroups" value="<?php p($_['passwordExcludedGroups']) ?>"
- style="width: 400px" class="noJSAutoUpdate double-indent"/>
+ style="width: 400px" class="noJSAutoUpdate double-indent" <?php if ($_['enableLinkPasswordByDefault'] !== 'yes') {
+ print_unescaped('disabled');
+} ?> />
</span><br/>
<?php } ?>