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 @@
/>
@@ -124,7 +126,9 @@
+ style="width: 400px" class="noJSAutoUpdate double-indent" />