Hi,

PFA patch for RM1450.


Changes: Added save password option in sever create mode.

-- 
*Harshal Dhumal*
*Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index 5128e74..5ea3d82 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -570,6 +570,8 @@ class ServerNode(PGChildNodeView):
                     )
                 )
 
+        server = None
+
         try:
             server = Server(
                 user_id=current_user.id,
@@ -596,8 +598,10 @@ class ServerNode(PGChildNodeView):
                 manager.update(server)
                 conn = manager.connection()
 
+                is_password =  False
                 if 'password' in data and data["password"] != '':
                     # login with password
+                    is_password = True
                     password = data['password']
                     password = encrypt(password, current_user.password)
                 else:
@@ -618,6 +622,10 @@ class ServerNode(PGChildNodeView):
                         errormsg=gettext("Unable to connect to server:\n\n%s" % errmsg)
                     )
                 else:
+                    if 'save_password' in data and data['save_password'] and is_password:
+                        setattr(server, 'password', password)
+                        db.session.commit()
+
                     user = manager.user_info
                     connected = True
                     icon = "icon-pg"
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
index 0a64143..601cdeb 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
@@ -580,7 +580,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
           username: '{{ username }}',
           role: null,
           connect_now: true,
-          password: undefined
+          password: undefined,
+          save_password: false
         },
         // Default values!
         initialize: function(attrs, args) {
@@ -641,6 +642,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
             return m.get('connect_now') && m.isNew();
           }
         },{
+          id: 'save_password', controlLabel:'{{ _('Save Password') }}', type: 'checkbox',
+          group: "{{ 'Connection' }}", mode: ['create'], deps: ['connect_now'],
+          visible: function(m) {
+            return m.get('connect_now') && m.isNew();
+          }
+        },{
           id: 'role', label:'{{ _('Role') }}', type: 'text', group: "{{ 'Connection' }}",
           mode: ['properties', 'edit', 'create'], disabled: 'isConnected'
         },{
-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to