mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 21:51:23 +00:00
Ticket #268: Only attempt to set password if field modified.
This commit is contained in:
@@ -514,6 +514,12 @@ GuacAdmin.reset = function() {
|
|||||||
reenter_password_field.setAttribute("type", "password");
|
reenter_password_field.setAttribute("type", "password");
|
||||||
reenter_password_field.setAttribute("value", "password");
|
reenter_password_field.setAttribute("value", "password");
|
||||||
|
|
||||||
|
// Update password if changed
|
||||||
|
var password_modified = false;
|
||||||
|
password_field.onchange = function() {
|
||||||
|
password_modified = true;
|
||||||
|
};
|
||||||
|
|
||||||
// Add save button
|
// Add save button
|
||||||
var save_button = GuacUI.createChildElement(button_div, "button");
|
var save_button = GuacUI.createChildElement(button_div, "button");
|
||||||
save_button.textContent = "Save";
|
save_button.textContent = "Save";
|
||||||
@@ -521,30 +527,42 @@ GuacAdmin.reset = function() {
|
|||||||
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
// Get passwords
|
try {
|
||||||
var password = undefined; /* STUB */
|
|
||||||
var reentered_password = undefined; /* STUB */
|
|
||||||
|
|
||||||
// Check that passwords match
|
// If password modified, use password given
|
||||||
if (password != reentered_password)
|
var password;
|
||||||
throw new Error("Passwords do not match.");
|
if (password_modified) {
|
||||||
|
|
||||||
// Do not update password if it's just the
|
// Get passwords
|
||||||
// not-changed token
|
password = password_field.value;
|
||||||
if (password == "f12a1930-7195-11e2-bcfd-0800200c9a66")
|
var reentered_password = reenter_password_field.value;
|
||||||
password = null;
|
|
||||||
|
|
||||||
// Set user permissions
|
// Check that passwords match
|
||||||
user_perms.read_connection = {};
|
if (password != reentered_password)
|
||||||
var connections = undefined; /* STUB (selected connections) */
|
throw new Error("Passwords do not match.");
|
||||||
for (var i=0; i<connections.length; i++)
|
|
||||||
user_perms.read_connection[connections[i]] = true;
|
|
||||||
|
|
||||||
// Save user
|
}
|
||||||
GuacamoleService.Users.update(
|
|
||||||
selected_user, password, user_perms);
|
// Otherwise, do not change password
|
||||||
deselect();
|
else
|
||||||
GuacAdmin.reset();
|
password = null;
|
||||||
|
|
||||||
|
// Set user permissions
|
||||||
|
user_perms.read_connection = {};
|
||||||
|
var connections = undefined; /* STUB (selected connections) */
|
||||||
|
for (var i=0; i<connections.length; i++)
|
||||||
|
user_perms.read_connection[connections[i]] = true;
|
||||||
|
|
||||||
|
// Save user
|
||||||
|
GuacamoleService.Users.update(
|
||||||
|
selected_user, password, user_perms);
|
||||||
|
deselect();
|
||||||
|
GuacAdmin.reset();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
alert(e.message);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user