'+
@@ -303,6 +317,38 @@ function setupConfigDialog() {
dialog.addClass("reveal-modal large max-height").attr("data-reveal", "");
+ $(".config_ssh_public_key_edit", '#config_dialog').on("click", function(){
+ $("#config_ssh_public_key_text", '#config_dialog').hide();
+ $("#config_ssh_public_key_textarea", '#config_dialog').show().focus();
+ });
+
+ $("#config_ssh_public_key_textarea", '#config_dialog').on("change", function(){
+ var user_id = getSelectedNodes(dataTable_users)[0];
+
+ OpenNebula.User.show({
+ data : {
+ id: -1
+ },
+ success: function(request,user_json){
+ var template = user_json.USER.TEMPLATE;
+
+ template["SSH_PUBLIC_KEY"] = $("#config_ssh_public_key_textarea", '#config_dialog').val();
+
+ template_str = "";
+ $.each(template,function(key,value){
+ template_str += (key + '=' + '"' + value + '"\n');
+ });
+
+ Sunstone.runAction("UserSettings.update_template", -1, template_str);
+ }
+ })
+ });
+
+ $("#config_ssh_public_key_textarea", '#config_dialog').on("focusout", function(){
+ $("#config_ssh_public_key_text", '#config_dialog').show();
+ $("#config_ssh_public_key_textarea", '#config_dialog').hide();
+ });
+
setupTips(dialog);
if (config['user_config']["vnc_wss"] == "yes"){
@@ -415,11 +461,22 @@ function updateUserConfigInfo(request,user_json) {
| \
')
+ var ssh_key;
+ if (info.TEMPLATE.SSH_PUBLIC_KEY) {
+ ssh_key = info.TEMPLATE.SSH_PUBLIC_KEY;
+ delete info.TEMPLATE.SSH_PUBLIC_KEY;
+ $("#config_ssh_public_key_text", "#config_dialog").text(ssh_key);
+ $("#config_ssh_public_key_textarea", "#config_dialog").val(ssh_key);
+ } else {
+ $("#config_ssh_public_key_text", "#config_dialog").text(tr("You can provide a SSH Key for this User clicking on the edit button"))
+ };
+
$("#setting_user_template").html(
insert_extended_template_table(info.TEMPLATE,
"UserSettings",
"-1",
- tr("Custom Attributes"))
+ tr("Custom Attributes"),
+ {SSH_PUBLIC_KEY: ssh_key})
)
$("#div_edit_chg_group_link").die();
diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js
index f247e26ee7..f1abb66774 100644
--- a/src/sunstone/public/js/plugins/users-tab.js
+++ b/src/sunstone/public/js/plugins/users-tab.js
@@ -594,7 +594,7 @@ function updateUserInfo(request,user){
\
\
\
-
'+tr("You can provide a SSH Key for this User clicking on the edit button")+'
\
+
'+tr("You can provide a SSH Key for this User clicking on the edit button")+'
\