diff options
author | Timo Benk <benk@b1-systems.de> | 2016-10-17 14:23:55 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2017-04-03 10:58:19 +0200 |
commit | 868500eda48a7938491a0e44ade07c9fcf635937 (patch) | |
tree | dad2019d2de21c027399d0ba1b1ea82e371e6fcb /core | |
parent | 0d7801b6ce04f3f60d9aa98afef4a019a4479193 (diff) | |
download | nextcloud-server-868500eda48a7938491a0e44ade07c9fcf635937.tar.gz nextcloud-server-868500eda48a7938491a0e44ade07c9fcf635937.zip |
let the user set an empty password for share link
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/js/sharedialoglinkshareview.js | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index 00b12ec1f99..dca1cf0c12c 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}}' + @@ -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}}' + @@ -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, |