Merge pull request #12273 from nextcloud/public-share-enforce-pass-fix
Fix password enforce on public share links
This commit is contained in:
commit
0f1edd538e
|
@ -1,7 +1,7 @@
|
||||||
{{#if shareAllowed}}
|
{{#if shareAllowed}}
|
||||||
<ul class="shareWithList">
|
<ul class="shareWithList">
|
||||||
{{#if nolinkShares}}
|
{{#if nolinkShares}}
|
||||||
<li data-share-id="new-share">
|
<li data-share-id="{{newShareId}}">
|
||||||
<div class="avatar icon-public-white"></div>
|
<div class="avatar icon-public-white"></div>
|
||||||
<span class="username">{{newShareLabel}}</span>
|
<span class="username">{{newShareLabel}}</span>
|
||||||
<span class="sharingOptionsGroup">
|
<span class="sharingOptionsGroup">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="popovermenu open menu">
|
<div class="popovermenu open menu pending">
|
||||||
<ul>
|
<ul>
|
||||||
{{#if isPasswordEnforced}}
|
{{#if isPasswordEnforced}}
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -45,6 +45,9 @@
|
||||||
/** @type {string} **/
|
/** @type {string} **/
|
||||||
password: '',
|
password: '',
|
||||||
|
|
||||||
|
/** @type {string} **/
|
||||||
|
newShareId: 'new-share',
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
// open menu
|
// open menu
|
||||||
'click .share-menu .icon-more': 'onToggleMenu',
|
'click .share-menu .icon-more': 'onToggleMenu',
|
||||||
|
@ -226,8 +229,8 @@
|
||||||
// We need a password before the share creation
|
// We need a password before the share creation
|
||||||
if (isPasswordEnforced && !this.showPending && this.password === '') {
|
if (isPasswordEnforced && !this.showPending && this.password === '') {
|
||||||
this.showPending = shareId;
|
this.showPending = shareId;
|
||||||
this.render();
|
var self = this.render();
|
||||||
$li.find('#enforcedPassText').focus();
|
self.$el.find('.pending #enforcedPassText').focus();
|
||||||
} else {
|
} else {
|
||||||
// else, we have a password or it is not enforced
|
// else, we have a password or it is not enforced
|
||||||
$.when(this.model.saveLinkShare(shareData, {
|
$.when(this.model.saveLinkShare(shareData, {
|
||||||
|
@ -248,11 +251,23 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
|
// empty function to override the default Dialog warning
|
||||||
|
}
|
||||||
|
})).fail(function(response) {
|
||||||
|
// password failure? Show error
|
||||||
|
self.password = ''
|
||||||
|
if (isPasswordEnforced && response && response.responseJSON && response.responseJSON.ocs.meta && response.responseJSON.ocs.meta.message) {
|
||||||
|
$input = self.$el.find('.pending #enforcedPassText')
|
||||||
|
$input.tooltip('destroy');
|
||||||
|
$input.attr('title', response.responseJSON.ocs.meta.message);
|
||||||
|
$input.tooltip({placement: 'bottom', trigger: 'manual'});
|
||||||
|
$input.tooltip('show');
|
||||||
|
} else {
|
||||||
OC.Notification.showTemporary(t('core', 'Unable to create a link share'));
|
OC.Notification.showTemporary(t('core', 'Unable to create a link share'));
|
||||||
$loading.addClass('hidden');
|
$loading.addClass('hidden');
|
||||||
$li.find('.icon').removeClass('hidden');
|
$li.find('.icon').removeClass('hidden');
|
||||||
}
|
}
|
||||||
})).then(function(response) {
|
}).then(function(response) {
|
||||||
// resolve before success
|
// resolve before success
|
||||||
newShareId = response.ocs.data.id
|
newShareId = response.ocs.data.id
|
||||||
});
|
});
|
||||||
|
@ -650,7 +665,8 @@
|
||||||
newShareLabel: t('core', 'Share link'),
|
newShareLabel: t('core', 'Share link'),
|
||||||
newShareTitle: t('core', 'New share link'),
|
newShareTitle: t('core', 'New share link'),
|
||||||
pendingPopoverMenu: pendingPopoverMenu,
|
pendingPopoverMenu: pendingPopoverMenu,
|
||||||
showPending: this.showPending === 'new',
|
showPending: this.showPending === this.newShareId,
|
||||||
|
newShareId: this.newShareId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.delegateEvents();
|
this.delegateEvents();
|
||||||
|
|
|
@ -10,7 +10,9 @@ templates['sharedialoglinkshareview'] = template({"1":function(container,depth0,
|
||||||
},"2":function(container,depth0,helpers,partials,data) {
|
},"2":function(container,depth0,helpers,partials,data) {
|
||||||
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
|
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
|
||||||
|
|
||||||
return " <li data-share-id=\"new-share\">\n <div class=\"avatar icon-public-white\"></div>\n <span class=\"username\">"
|
return " <li data-share-id=\""
|
||||||
|
+ alias4(((helper = (helper = helpers.newShareId || (depth0 != null ? depth0.newShareId : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"newShareId","hash":{},"data":data}) : helper)))
|
||||||
|
+ "\">\n <div class=\"avatar icon-public-white\"></div>\n <span class=\"username\">"
|
||||||
+ alias4(((helper = (helper = helpers.newShareLabel || (depth0 != null ? depth0.newShareLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"newShareLabel","hash":{},"data":data}) : helper)))
|
+ alias4(((helper = (helper = helpers.newShareLabel || (depth0 != null ? depth0.newShareLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"newShareLabel","hash":{},"data":data}) : helper)))
|
||||||
+ "</span>\n <span class=\"sharingOptionsGroup\">\n <div class=\"share-menu\">\n <a href=\"#\" class=\"icon icon-add new-share has-tooltip "
|
+ "</span>\n <span class=\"sharingOptionsGroup\">\n <div class=\"share-menu\">\n <a href=\"#\" class=\"icon icon-add new-share has-tooltip "
|
||||||
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showPending : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showPending : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||||
|
@ -269,7 +271,7 @@ templates['sharedialoglinkshareview_popover_menu_pending'] = template({"1":funct
|
||||||
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||||
var stack1;
|
var stack1;
|
||||||
|
|
||||||
return "<div class=\"popovermenu open menu\">\n <ul>\n"
|
return "<div class=\"popovermenu open menu pending\">\n <ul>\n"
|
||||||
+ ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.isPasswordEnforced : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
+ ((stack1 = helpers["if"].call(depth0 != null ? depth0 : (container.nullContext || {}),(depth0 != null ? depth0.isPasswordEnforced : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||||
+ " </ul>\n</div>\n";
|
+ " </ul>\n</div>\n";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
|
|
Loading…
Reference in New Issue