diff options
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/core.json | 2 | ||||
-rw-r--r-- | core/js/shareconfigmodel.js | 1 | ||||
-rw-r--r-- | core/js/sharedialoglinkshareview.js | 28 |
3 files changed, 25 insertions, 6 deletions
diff --git a/core/js/core.json b/core/js/core.json index 828dd71f611..e03d4cce190 100644 --- a/core/js/core.json +++ b/core/js/core.json @@ -12,7 +12,7 @@ "es6-promise/dist/es6-promise.js", "davclient.js/lib/client.js", "clipboard/dist/clipboard.min.js", - "autosize/dist/autosize.js", + "autosize/dist/autosize.min.js", "DOMPurify/dist/purify.min.js", "snapjs/dist/latest/snap.js", "select2/select2.js" diff --git a/core/js/shareconfigmodel.js b/core/js/shareconfigmodel.js index 98388cbd508..1ead631db4d 100644 --- a/core/js/shareconfigmodel.js +++ b/core/js/shareconfigmodel.js @@ -22,6 +22,7 @@ defaults: { publicUploadEnabled: false, enforcePasswordForPublicLink: oc_appconfig.core.enforcePasswordForPublicLink, + enableLinkPasswordByDefault: oc_appconfig.core.enableLinkPasswordByDefault, isDefaultExpireDateEnforced: oc_appconfig.core.defaultExpireDateEnforced === true, isDefaultExpireDateEnabled: oc_appconfig.core.defaultExpireDateEnabled === true, isRemoteShareAllowed: oc_appconfig.core.remoteShareAllowed, diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index d881b85f70f..36f15a7269d 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -17,6 +17,7 @@ var PASSWORD_PLACEHOLDER = '**********'; var PASSWORD_PLACEHOLDER_MESSAGE = t('core', 'Choose a password for the public link'); + var PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL = t('core', 'Choose a password for the public link or press enter'); var TEMPLATE = '{{#if shareAllowed}}' + @@ -30,7 +31,7 @@ '{{#if singleAction}}' + '<a class="{{#unless isLinkShare}}hidden-visually{{/unless}} clipboardButton icon icon-clippy" data-clipboard-target="#linkText-{{cid}}"></a>' + '{{else}}' + - '<a href="#"><span class="linkMore icon icon-more"></span></a>' + + '<a class="{{#unless isLinkShare}}hidden-visually{{/unless}}" href="#"><span class="linkMore icon icon-more"></span></a>' + '{{{popoverMenu}}}' + '{{/if}}' + '</div>' + @@ -61,7 +62,11 @@ ' {{/if}}' + '<div id="linkPass" class="linkPass {{#unless isPasswordSet}}hidden{{/unless}}">' + ' <label for="linkPassText-{{cid}}" class="hidden-visually">{{passwordLabel}}</label>' + + ' {{#if showPasswordCheckBox}}' + ' <input id="linkPassText-{{cid}}" class="linkPassText" type="password" placeholder="{{passwordPlaceholder}}" />' + + ' {{else}}' + + ' <input id="linkPassText-{{cid}}" class="linkPassText" type="password" placeholder="{{passwordPlaceholderInitial}}" />' + + ' {{/if}}' + ' <span class="icon-loading-small hidden"></span>' + '</div>' + '{{else}}' + @@ -228,7 +233,7 @@ } if($checkBox.is(':checked')) { - if(this.configModel.get('enforcePasswordForPublicLink') === false) { + if(this.configModel.get('enforcePasswordForPublicLink') === false && this.configModel.get('enableLinkPasswordByDefault') === false) { $loading.removeClass('hidden'); // this will create it this.model.saveLinkShare(); @@ -280,9 +285,19 @@ var $input = this.$el.find('.linkPassText'); $input.removeClass('error'); var password = $input.val(); - // in IE9 the password might be the placeholder due to bugs in the placeholders polyfill - if(password === '' || password === PASSWORD_PLACEHOLDER || password === PASSWORD_PLACEHOLDER_MESSAGE) { - return; + + if (this.$el.find('.linkPassText').attr('placeholder') === PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL) { + + // in IE9 the password might be the placeholder due to bugs in the placeholders polyfill + if(password === PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL) { + password = ''; + } + } else { + + // in IE9 the password might be the placeholder due to bugs in the placeholders polyfill + if(password === '' || password === PASSWORD_PLACEHOLDER || password === PASSWORD_PLACEHOLDER_MESSAGE) { + return; + } } $loading @@ -391,6 +406,8 @@ var showPasswordCheckBox = isLinkShare && ( !this.configModel.get('enforcePasswordForPublicLink') || !this.model.get('linkShare').password); + var passwordPlaceholderInitial = this.configModel.get('enforcePasswordForPublicLink') + ? PASSWORD_PLACEHOLDER_MESSAGE : PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL; var publicEditable = !this.model.isFolder() @@ -428,6 +445,7 @@ enablePasswordLabel: t('core', 'Password protect'), passwordLabel: t('core', 'Password'), passwordPlaceholder: isPasswordSet ? PASSWORD_PLACEHOLDER : PASSWORD_PLACEHOLDER_MESSAGE, + passwordPlaceholderInitial: passwordPlaceholderInitial, isPasswordSet: isPasswordSet, showPasswordCheckBox: showPasswordCheckBox, publicUpload: publicUpload && isLinkShare, |