diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js
index fd5344419a..5b66579fad 100644
--- a/src/sunstone/public/js/plugins/users-tab.js
+++ b/src/sunstone/public/js/plugins/users-tab.js
@@ -20,6 +20,7 @@ var users_select="";
var $create_user_dialog;
var $user_quotas_dialog;
var $update_pw_dialog;
+var $change_auth_dialog;
var user_acct_graphs = [
{ title : tr("CPU"),
@@ -93,6 +94,21 @@ var users_tab_content = '\
\
';
+// authn = "ssh,x509,ldap,server_cipher,server_x509"
+
+var auth_drivers_div =
+'\
+
\
+ \
+
';
+
var create_user_tmpl =
'\
\
@@ -126,18 +142,7 @@ var create_user_tmpl =
\
\
\
- \
-
\
-
\
- \
-
\
-
\
+ '+auth_drivers_div+'
\
\
@@ -175,6 +180,26 @@ var update_pw_tmpl = '\
×\
';
+var change_password_tmpl = '
\
+
\
+ \
+
\
+\
+
';
+
var user_quotas_tmpl = '
\
\
\
@@ -403,6 +428,10 @@ var user_actions = {
notify: true
},
+ "User.change_authentication" : {
+ type: "custom",
+ call: popUpChangeAuthenticationDialog
+ },
"User.chauth" : {
type: "multiple",
call: OpenNebula.User.chauth,
@@ -413,7 +442,6 @@ var user_actions = {
error: onError,
notify: true
},
-
"User.show" : {
type: "single",
call: OpenNebula.User.show,
@@ -514,6 +542,11 @@ var user_buttons = {
layout: "more_select",
text : tr("Change password")
},
+ "User.change_authentication" : {
+ type : "action",
+ layout: "more_select",
+ text : tr("Change authentication")
+ },
"User.quotas_dialog" : {
type : "action",
layout: "more_select",
@@ -528,20 +561,6 @@ var user_buttons = {
tip: tr("This will change the main group of the selected users. Select the new group")+":",
condition: mustBeAdmin
},
- "User.chauth" : {
- type: "confirm_with_select",
- text: tr("Change authentication"),
- layout: "user_select",
- //We insert our custom select there.
- select: function() {
- return '\
- \
- \
- '
- },
- tip: tr("Please choose the new type of authentication for the selected users")+":",
- condition: mustBeAdmin
- },
"User.delete" : {
type: "confirm",
text: tr("Delete"),
@@ -862,6 +881,37 @@ function setupUpdatePasswordDialog(){
});
};
+function setupChangeAuthenticationDialog(){
+ dialogs_context.append('
');
+ $change_auth_dialog = $('#change_user_auth_dialog',dialogs_context);
+ var dialog = $change_auth_dialog;
+ dialog.html(change_password_tmpl);
+
+ dialog.addClass("reveal-modal");
+
+ $('input[name="custom_auth"]',dialog).parent().hide();
+ $('select#driver').change(function(){
+ if ($(this).val() == "custom")
+ $('input[name="custom_auth"]',dialog).parent().show();
+ else
+ $('input[name="custom_auth"]',dialog).parent().hide();
+ });
+
+ $('#change_password_form',dialog).submit(function(){
+ var driver = $('#driver', this).val();
+ if (driver == 'custom')
+ driver = $('input[name="custom_auth"]', this).val();
+
+ if (!driver.length){
+ notifyError(tr("Fill in a new auth driver"));
+ return false;
+ }
+
+ Sunstone.runAction("User.chauth",getSelectedNodes(dataTable_users), driver);
+ $change_auth_dialog.trigger("reveal:close")
+ return false;
+ });
+};
//add a setup quota dialog and call the sunstone-util.js initialization
function setupUserQuotasDialog(){
@@ -888,6 +938,11 @@ function popUpUpdatePasswordDialog(){
$update_pw_dialog.reveal();
}
+function popUpChangeAuthenticationDialog(){
+ $('#driver',$change_auth_dialog).val("");
+ $change_auth_dialog.reveal();
+}
+
// Prepare the autorefresh of the list
function setUserAutorefresh(){
setInterval(function(){
@@ -920,6 +975,7 @@ $(document).ready(function(){
setupCreateUserDialog();
setupUpdatePasswordDialog();
+ setupChangeAuthenticationDialog();
setupUserQuotasDialog();
setUserAutorefresh();
//Setup quota icons