Improve access modal password section

pull/1/head
yflory 4 years ago
parent d3db915927
commit 1f7aca39ab

@ -814,28 +814,21 @@ define([
])); ]));
} }
var $pwLabel = $('<label>', {'for': 'cp-app-prop-password'})
.text(Messages.creation_passwordValue).appendTo($d);
var hasPassword = data.password; var hasPassword = data.password;
if (hasPassword) { var password = UI.passwordInput({
$('<label>', {'for': 'cp-app-prop-password'}).text(Messages.creation_passwordValue).appendTo($d); id: 'cp-app-prop-password',
var password = UI.passwordInput({ readonly: 'readonly'
id: 'cp-app-prop-password', });
readonly: 'readonly' var $password = $(password).appendTo($d);
}); var $pwInput = $password.find('.cp-password-input');
$d.append(password); $pwInput.val(data.password || '').click(function () {
var $pwInput = $(password).find('.cp-password-input'); $pwInput[0].select();
$pwInput.val(data.password || '').click(function () { });
$pwInput[0].select(); if (!hasPassword) {
}); $password.hide();
} else { $pwLabel.hide();
/*
// XXX don't show the "current password" field if there is no password?
Messages.noPassword = "No password";
$d.append(h('div.cp-app-prop', [
Messages.creation_passwordValue,
h('br'),
h('span.cp-app-prop-content', Messages.noPassword)
]));
*/
} }
// In the properties, we should have the edit href if we know it. // In the properties, we should have the edit href if we know it.
@ -910,6 +903,13 @@ define([
UI.findOKButton().click(); UI.findOKButton().click();
$pwInput.val(newPass); $pwInput.val(newPass);
if (newPass) {
$password.show();
$pwLabel.show();
} else {
$password.hide();
$pwLabel.hide();
}
// If the current document is a file or if we're changing the password from a drive, // 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. // we don't have to reload the page at the end.

Loading…
Cancel
Save