let the user set an empty password for share link
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
parent
0d7801b6ce
commit
868500eda4
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
var PASSWORD_PLACEHOLDER = '**********';
|
var PASSWORD_PLACEHOLDER = '**********';
|
||||||
var PASSWORD_PLACEHOLDER_MESSAGE = t('core', 'Choose a password for the public link');
|
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 =
|
var TEMPLATE =
|
||||||
'{{#if shareAllowed}}' +
|
'{{#if shareAllowed}}' +
|
||||||
|
@ -61,7 +62,11 @@
|
||||||
' {{/if}}' +
|
' {{/if}}' +
|
||||||
'<div id="linkPass" class="linkPass {{#unless isPasswordSet}}hidden{{/unless}}">' +
|
'<div id="linkPass" class="linkPass {{#unless isPasswordSet}}hidden{{/unless}}">' +
|
||||||
' <label for="linkPassText-{{cid}}" class="hidden-visually">{{passwordLabel}}</label>' +
|
' <label for="linkPassText-{{cid}}" class="hidden-visually">{{passwordLabel}}</label>' +
|
||||||
|
' {{#if showPasswordCheckBox}}' +
|
||||||
' <input id="linkPassText-{{cid}}" class="linkPassText" type="password" placeholder="{{passwordPlaceholder}}" />' +
|
' <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>' +
|
' <span class="icon-loading-small hidden"></span>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'{{else}}' +
|
'{{else}}' +
|
||||||
|
@ -280,9 +285,19 @@
|
||||||
var $input = this.$el.find('.linkPassText');
|
var $input = this.$el.find('.linkPassText');
|
||||||
$input.removeClass('error');
|
$input.removeClass('error');
|
||||||
var password = $input.val();
|
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) {
|
if (this.$el.find('.linkPassText').attr('placeholder') === PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL) {
|
||||||
return;
|
|
||||||
|
// 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
|
$loading
|
||||||
|
@ -391,6 +406,8 @@
|
||||||
var showPasswordCheckBox = isLinkShare
|
var showPasswordCheckBox = isLinkShare
|
||||||
&& ( !this.configModel.get('enforcePasswordForPublicLink')
|
&& ( !this.configModel.get('enforcePasswordForPublicLink')
|
||||||
|| !this.model.get('linkShare').password);
|
|| !this.model.get('linkShare').password);
|
||||||
|
var passwordPlaceholderInitial = this.configModel.get('enforcePasswordForPublicLink')
|
||||||
|
? PASSWORD_PLACEHOLDER_MESSAGE : PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL;
|
||||||
|
|
||||||
var publicEditable =
|
var publicEditable =
|
||||||
!this.model.isFolder()
|
!this.model.isFolder()
|
||||||
|
@ -428,6 +445,7 @@
|
||||||
enablePasswordLabel: t('core', 'Password protect'),
|
enablePasswordLabel: t('core', 'Password protect'),
|
||||||
passwordLabel: t('core', 'Password'),
|
passwordLabel: t('core', 'Password'),
|
||||||
passwordPlaceholder: isPasswordSet ? PASSWORD_PLACEHOLDER : PASSWORD_PLACEHOLDER_MESSAGE,
|
passwordPlaceholder: isPasswordSet ? PASSWORD_PLACEHOLDER : PASSWORD_PLACEHOLDER_MESSAGE,
|
||||||
|
passwordPlaceholderInitial: passwordPlaceholderInitial,
|
||||||
isPasswordSet: isPasswordSet,
|
isPasswordSet: isPasswordSet,
|
||||||
showPasswordCheckBox: showPasswordCheckBox,
|
showPasswordCheckBox: showPasswordCheckBox,
|
||||||
publicUpload: publicUpload && isLinkShare,
|
publicUpload: publicUpload && isLinkShare,
|
||||||
|
|
Loading…
Reference in New Issue