|
|
|
@ -547,21 +547,27 @@ define([
|
|
|
|
|
|
|
|
|
|
if (!data.noPassword) {
|
|
|
|
|
var hasPassword = data.password;
|
|
|
|
|
var $pwLabel = $('<label>', {'for': 'cp-app-prop-password'}).text(Messages.creation_passwordValue)
|
|
|
|
|
.hide().appendTo($d);
|
|
|
|
|
var password = UI.passwordInput({
|
|
|
|
|
id: 'cp-app-prop-password',
|
|
|
|
|
readonly: 'readonly'
|
|
|
|
|
});
|
|
|
|
|
var $password = $(password).hide();
|
|
|
|
|
var $pwInput = $password.find('.cp-password-input');
|
|
|
|
|
$pwInput.val(data.password).click(function () {
|
|
|
|
|
$pwInput[0].select();
|
|
|
|
|
});
|
|
|
|
|
$d.append(password);
|
|
|
|
|
|
|
|
|
|
if (hasPassword) {
|
|
|
|
|
$('<label>', {'for': 'cp-app-prop-password'}).text(Messages.creation_passwordValue)
|
|
|
|
|
.appendTo($d);
|
|
|
|
|
var password = UI.passwordInput({
|
|
|
|
|
id: 'cp-app-prop-password',
|
|
|
|
|
readonly: 'readonly'
|
|
|
|
|
});
|
|
|
|
|
var $pwInput = $(password).find('.cp-password-input');
|
|
|
|
|
$pwInput.val(data.password).click(function () {
|
|
|
|
|
$pwInput[0].select();
|
|
|
|
|
});
|
|
|
|
|
$d.append(password);
|
|
|
|
|
$pwLabel.show();
|
|
|
|
|
$password.css('display', 'flex');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!data.noEditPassword && owned) { // FIXME SHEET fix password change for sheets
|
|
|
|
|
// In the properties, we should have the edit href if we know it.
|
|
|
|
|
// We should know it because the pad is stored, but it's better to check...
|
|
|
|
|
if (!data.noEditPassword && owned && data.href) { // FIXME SHEET fix password change for sheets
|
|
|
|
|
var sframeChan = common.getSframeChannel();
|
|
|
|
|
|
|
|
|
|
var isOO = parsed.type === 'sheet';
|
|
|
|
@ -621,7 +627,7 @@ define([
|
|
|
|
|
|
|
|
|
|
sframeChan.query(q, {
|
|
|
|
|
teamId: typeof(owned) !== "boolean" ? owned : undefined,
|
|
|
|
|
href: data.href || data.roHref,
|
|
|
|
|
href: data.href,
|
|
|
|
|
password: newPass
|
|
|
|
|
}, function (err, data) {
|
|
|
|
|
$(passwordOk).text(Messages.properties_changePasswordButton);
|
|
|
|
@ -631,8 +637,16 @@ define([
|
|
|
|
|
return void UI.alert(Messages.properties_passwordError);
|
|
|
|
|
}
|
|
|
|
|
UI.findOKButton().click();
|
|
|
|
|
if (isFile) {
|
|
|
|
|
onProgress.stop();
|
|
|
|
|
|
|
|
|
|
$pwLabel.show();
|
|
|
|
|
$password.css('display', 'flex');
|
|
|
|
|
$pwInput.val(newPass);
|
|
|
|
|
|
|
|
|
|
// If the current document is a file or if we're changing the password from a drive,
|
|
|
|
|
// we don't have to reload the page at the end.
|
|
|
|
|
// Tell the user the password change was successful and abort
|
|
|
|
|
if (isFile || priv.app !== parsed.type) {
|
|
|
|
|
if (onProgress && onProgress.stop) { onProgress.stop(); }
|
|
|
|
|
$(passwordOk).text(Messages.properties_changePasswordButton);
|
|
|
|
|
var alertMsg = data.warning ? Messages.properties_passwordWarningFile
|
|
|
|
|
: Messages.properties_passwordSuccessFile;
|
|
|
|
@ -642,7 +656,7 @@ define([
|
|
|
|
|
// Pad password changed: update the href
|
|
|
|
|
// 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']);
|
|
|
|
|
var href = data.href || data.roHref;
|
|
|
|
|
var href = (priv.readOnly && data.roHref) ? data.roHref : data.href;
|
|
|
|
|
if (!useUnsafe) {
|
|
|
|
|
var newParsed = Hash.parsePadUrl(href);
|
|
|
|
|
var newSecret = Hash.getSecrets(newParsed.type, newParsed.hash, newPass);
|
|
|
|
|