summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-04-04 11:04:21 +0200
committerGitHub <noreply@github.com>2017-04-04 11:04:21 +0200
commitefb21a948e586d2080e179ce6b4b271132561ad7 (patch)
treec63d1d2cbb5b16abd65da5c683ddcf7c4ed2d34b /core
parent0d69b52fde739776242fdc0780c0e90d7faefa23 (diff)
parent5e7197e49fa6eacb329386aa65e89a4f5d0c2014 (diff)
downloadnextcloud-server-efb21a948e586d2080e179ce6b4b271132561ad7.tar.gz
nextcloud-server-efb21a948e586d2080e179ce6b4b271132561ad7.zip
Merge pull request #4093 from nextcloud/endorse-password-protection
Endorse password protection
Diffstat (limited to 'core')
-rw-r--r--core/js/shareconfigmodel.js1
-rw-r--r--core/js/sharedialoglinkshareview.js26
2 files changed, 23 insertions, 4 deletions
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 f1cbea17928..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}}' +
@@ -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,