mirror of https://github.com/xwiki-labs/cryptpad
Fix access modal issues after password change #1365
This commit is contained in:
parent
645926c2ef
commit
aad3669556
|
@ -1527,6 +1527,7 @@ define([
|
|||
hash: newHash,
|
||||
href: newHref,
|
||||
roHref: newRoHref,
|
||||
channel: newSecret.channel
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -30,7 +30,6 @@ define([
|
|||
var metadataMgr = common.getMetadataMgr();
|
||||
|
||||
var priv = metadataMgr.getPrivateData();
|
||||
var channel = data.channel || priv.channel;
|
||||
var owners = data.owners || [];
|
||||
var pending_owners = data.pending_owners || [];
|
||||
var teamOwner = data.teamId;
|
||||
|
@ -105,7 +104,7 @@ define([
|
|||
}).nThen(function (waitFor) {
|
||||
// Send the command
|
||||
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||
channel: channel,
|
||||
channel: data.channel || priv.channel,
|
||||
channels: otherChan,
|
||||
command: pending ? 'RM_PENDING_OWNERS' : 'RM_OWNERS',
|
||||
value: [ed],
|
||||
|
@ -127,7 +126,7 @@ define([
|
|||
var friend = friends[curve];
|
||||
if (!friend) { return; }
|
||||
common.mailbox.sendTo("RM_OWNER", {
|
||||
channel: channel,
|
||||
channel: data.channel || priv.channel,
|
||||
title: data.title || title,
|
||||
pending: pending
|
||||
}, {
|
||||
|
@ -265,7 +264,7 @@ define([
|
|||
if (toAddTeams.length) {
|
||||
// Send the command
|
||||
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||
channel: channel,
|
||||
channel: data.channel || priv.channel,
|
||||
channels: otherChan,
|
||||
command: 'ADD_OWNERS',
|
||||
value: toAddTeams.map(function (obj) { return obj.edPublic; }),
|
||||
|
@ -301,7 +300,7 @@ define([
|
|||
if (toAdd.length) {
|
||||
// Send the command
|
||||
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||
channel: channel,
|
||||
channel: data.channel || priv.channel,
|
||||
channels: otherChan,
|
||||
command: 'ADD_PENDING_OWNERS',
|
||||
value: toAdd,
|
||||
|
@ -322,7 +321,7 @@ define([
|
|||
if (addMe) {
|
||||
// Send the command
|
||||
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||
channel: channel,
|
||||
channel: data.channel || priv.channel,
|
||||
channels: otherChan,
|
||||
command: 'ADD_OWNERS',
|
||||
value: [priv.edPublic],
|
||||
|
@ -352,7 +351,7 @@ define([
|
|||
var friend = friends[curve];
|
||||
if (!friend) { return; }
|
||||
common.mailbox.sendTo("ADD_OWNER", {
|
||||
channel: channel,
|
||||
channel: data.channel || priv.channel,
|
||||
channels: otherChan,
|
||||
href: href,
|
||||
calendar: opts.calendar,
|
||||
|
@ -427,7 +426,6 @@ define([
|
|||
var metadataMgr = common.getMetadataMgr();
|
||||
|
||||
var priv = metadataMgr.getPrivateData();
|
||||
var channel = data.channel || priv.channel;
|
||||
var owners = data.owners || [];
|
||||
var restricted = data.restricted || false;
|
||||
var allowed = data.allowed || [];
|
||||
|
@ -516,7 +514,7 @@ define([
|
|||
*/
|
||||
// Send the command
|
||||
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||
channel: channel,
|
||||
channel: data.channel || priv.channel,
|
||||
channels: otherChan,
|
||||
command: 'RM_ALLOWED',
|
||||
value: [ed],
|
||||
|
@ -546,7 +544,7 @@ define([
|
|||
spinner.spin();
|
||||
var val = $checkbox.is(':checked');
|
||||
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||
channel: channel,
|
||||
channel: data.channel || priv.channel,
|
||||
channels: otherChan,
|
||||
command: 'RESTRICT_ACCESS',
|
||||
value: [Boolean(val)],
|
||||
|
@ -682,7 +680,7 @@ define([
|
|||
if (toAdd.length) {
|
||||
// Send the command
|
||||
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||
channel: channel,
|
||||
channel: data.channel || priv.channel,
|
||||
channels: otherChan,
|
||||
command: 'ADD_ALLOWED',
|
||||
value: toAdd,
|
||||
|
@ -939,12 +937,12 @@ define([
|
|||
sframeChan.query(q, {
|
||||
teamId: typeof(owned) !== "boolean" ? owned : undefined,
|
||||
href: href,
|
||||
oldPassword: priv.password,
|
||||
oldPassword: data.password || priv.password,
|
||||
password: newPass
|
||||
}, function (err, data) {
|
||||
}, function (err, res) {
|
||||
$(passwordOk).text(Messages.properties_changePasswordButton);
|
||||
pLocked = false;
|
||||
err = err || data.error;
|
||||
err = err || res.error;
|
||||
if (err) {
|
||||
if (err === "PASSWORD_ALREADY_USED") {
|
||||
return void UI.alert(Messages.access_passwordUsed);
|
||||
|
@ -954,6 +952,11 @@ define([
|
|||
}
|
||||
UI.findOKButton().click();
|
||||
|
||||
data.password = newPass;
|
||||
data.href = res.href;
|
||||
data.roHref = res.roHref;
|
||||
data.channel = res.channel;
|
||||
|
||||
$pwInput.val(newPass);
|
||||
if (newPass) {
|
||||
$password.show();
|
||||
|
@ -969,7 +972,7 @@ define([
|
|||
if (isFile || priv.app !== parsed.type) {
|
||||
if (onProgress && onProgress.stop) { onProgress.stop(); }
|
||||
$(passwordOk).text(Messages.properties_changePasswordButton);
|
||||
var alertMsg = data.warning ? Messages.properties_passwordWarningFile
|
||||
var alertMsg = res.warning ? Messages.properties_passwordWarningFile
|
||||
: Messages.properties_passwordSuccessFile;
|
||||
return void UI.alert(alertMsg, undefined, {force: true});
|
||||
}
|
||||
|
@ -978,7 +981,7 @@ define([
|
|||
// Use hidden hash if needed (we're an owner of this pad so we know it is stored)
|
||||
var useUnsafe = Util.find(priv, ['settings', 'security', 'unsafeLinks']);
|
||||
if (isNotStored) { useUnsafe = true; }
|
||||
var _href = (priv.readOnly && data.roHref) ? data.roHref : data.href;
|
||||
var _href = (priv.readOnly && res.roHref) ? res.roHref : res.href;
|
||||
if (useUnsafe !== true) {
|
||||
var newParsed = Hash.parsePadUrl(_href);
|
||||
var newSecret = Hash.getSecrets(newParsed.type, newParsed.hash, newPass);
|
||||
|
@ -989,7 +992,7 @@ define([
|
|||
// Trigger a page reload if the href didn't change
|
||||
if (_href === href) { _href = undefined; }
|
||||
|
||||
if (data.warning) {
|
||||
if (res.warning) {
|
||||
return void UI.alert(Messages.properties_passwordWarning, function () {
|
||||
if (isNotStored) {
|
||||
return sframeChan.query('Q_PASSWORD_CHECK', newPass, () => { common.gotoURL(_href); });
|
||||
|
|
Loading…
Reference in New Issue