]> source.dussan.org Git - nextcloud-server.git/commitdiff
let the user set an empty password for share link
authorTimo Benk <benk@b1-systems.de>
Mon, 17 Oct 2016 12:23:55 +0000 (14:23 +0200)
committerBjoern Schiessle <bjoern@schiessle.org>
Mon, 3 Apr 2017 08:58:19 +0000 (10:58 +0200)
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
core/js/sharedialoglinkshareview.js

index 00b12ec1f99fab7ff83f5d56b5da4885914c494e..dca1cf0c12ce63f2c2fa474fd293f9c74eec70b6 100644 (file)
@@ -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}}' +
                        '    {{/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}}' +
                        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
                        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()
                                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,