public inbox for [email protected]
help / color / mirror / Atom feedFrom: Harshal Dhumal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: patch for RM1450 [pgAdmin4]
Date: Wed, 3 Aug 2016 18:00:58 +0530
Message-ID: <CAFiP3vzpcBNxvsBv0-nGbwWaRXyxa5Z8Bybszt405eY6BDqZAA@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-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'
},{
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: patch for RM1450 [pgAdmin4]
In-Reply-To: <CAFiP3vzpcBNxvsBv0-nGbwWaRXyxa5Z8Bybszt405eY6BDqZAA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox