public inbox for [email protected]  
help / color / mirror / Atom feed
patch for RM1450 [pgAdmin4]
2+ messages / 2 participants
[nested] [flat]

* patch for RM1450 [pgAdmin4]
@ 2016-08-03 12:30 Harshal Dhumal <[email protected]>
  2016-08-03 14:56 ` Re: patch for RM1450 [pgAdmin4] Dave Page <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Harshal Dhumal @ 2016-08-03 12:30 UTC (permalink / raw)
  To: pgadmin-hackers

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


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [text/x-patch] RM1450.patch (2.7K, 3-RM1450.patch)
  download | inline diff:
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'
         },{


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: patch for RM1450 [pgAdmin4]
  2016-08-03 12:30 patch for RM1450 [pgAdmin4] Harshal Dhumal <[email protected]>
@ 2016-08-03 14:56 ` Dave Page <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2016-08-03 14:56 UTC (permalink / raw)
  To: Harshal Dhumal <[email protected]>; +Cc: pgadmin-hackers

Thanks - applied.

I did a little string and layout cleanup whilst I was passing as well.

On Wed, Aug 3, 2016 at 1:30 PM, Harshal Dhumal
<[email protected]> wrote:
> 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
>
>
> --
> Sent via pgadmin-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-08-03 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-08-03 12:30 patch for RM1450 [pgAdmin4] Harshal Dhumal <[email protected]>
2016-08-03 14:56 ` Dave Page <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox