diff --git a/src/sunstone/public/app/tabs/settings-tab.js b/src/sunstone/public/app/tabs/settings-tab.js index c6984cc322..fc3e984646 100644 --- a/src/sunstone/public/app/tabs/settings-tab.js +++ b/src/sunstone/public/app/tabs/settings-tab.js @@ -13,6 +13,7 @@ define(function(require) { }; var _dialogs = [ + require('tabs/users-tab/dialogs/password') ]; var _panels = [ diff --git a/src/sunstone/public/app/tabs/users-tab/actions.js b/src/sunstone/public/app/tabs/users-tab/actions.js index 9aa00c21c1..42812c669c 100644 --- a/src/sunstone/public/app/tabs/users-tab/actions.js +++ b/src/sunstone/public/app/tabs/users-tab/actions.js @@ -62,6 +62,9 @@ define(function(require) { "User.update_password" : { type: "custom", call: function(){ + Sunstone.getDialog(PASSWORD_DIALOG_ID).setParams( + {selectedElements: Sunstone.getDataTable(TAB_ID).elements()}); + Sunstone.getDialog(PASSWORD_DIALOG_ID).reset(); Sunstone.getDialog(PASSWORD_DIALOG_ID).show(); } }, diff --git a/src/sunstone/public/app/tabs/users-tab/dialogs/password.js b/src/sunstone/public/app/tabs/users-tab/dialogs/password.js index f957f959ee..6dbaef2f78 100644 --- a/src/sunstone/public/app/tabs/users-tab/dialogs/password.js +++ b/src/sunstone/public/app/tabs/users-tab/dialogs/password.js @@ -35,13 +35,22 @@ define(function(require) { Dialog.prototype.html = _html; Dialog.prototype.onShow = _onShow; Dialog.prototype.setup = _setup; + Dialog.prototype.setParams = _setParams; return Dialog; - + /* FUNCTION DEFINITIONS */ + /** + * @param {object} params + * - params.selectedElements : Array of user ids + */ + function _setParams(params) { + this.selectedElements = params.selectedElements; + } + function _html() { return TemplateHTML({ 'dialogId': this.dialogId, @@ -68,9 +77,7 @@ define(function(require) { var inputs = that.userCreation.retrieve(context); - var selElems = Sunstone.getDataTable(TAB_ID).elements(); - - Sunstone.runAction('User.passwd', selElems, inputs.password); + Sunstone.runAction('User.passwd', that.selectedElements, inputs.password); Sunstone.getDialog(DIALOG_ID).hide(); Sunstone.getDialog(DIALOG_ID).reset(); diff --git a/src/sunstone/public/app/tabs/users-tab/panels/info.js b/src/sunstone/public/app/tabs/users-tab/panels/info.js index 727d7d7ce7..650a978a7f 100644 --- a/src/sunstone/public/app/tabs/users-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/users-tab/panels/info.js @@ -24,6 +24,7 @@ define(function(require) { var PANEL_ID = require('./info/panelId'); var RESOURCE = "User"; var XML_ROOT = "USER"; + var PASSWORD_DIALOG_ID = require('tabs/users-tab/dialogs/password/dialogId'); /* CONSTRUCTOR @@ -132,6 +133,15 @@ define(function(require) { $("#user_ssh_public_key_textarea", context).show().focus(); }); + // Password button + context.off("click", "#update_password"); + context.on("click", "#update_password", function(){ + Sunstone.getDialog(PASSWORD_DIALOG_ID).setParams( + {selectedElements: [that.element.ID]}); + Sunstone.getDialog(PASSWORD_DIALOG_ID).reset(); + Sunstone.getDialog(PASSWORD_DIALOG_ID).show(); + }); + context.off("change", "#user_ssh_public_key_textarea"); context.on("change", "#user_ssh_public_key_textarea", function() { var user_id = that.element.ID; diff --git a/src/sunstone/public/app/tabs/users-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/users-tab/panels/info/html.hbs index e99a021b7a..a67bb0ae86 100644 --- a/src/sunstone/public/app/tabs/users-tab/panels/info/html.hbs +++ b/src/sunstone/public/app/tabs/users-tab/panels/info/html.hbs @@ -28,6 +28,14 @@ {{element.AUTH_DRIVER}} + + {{tr "Password"}} + + + + {{tr "Table Order"}} {{valOrDefault element.TEMPLATE.TABLE_ORDER "-"}}