Hi,

PFA attached patch for RM1313 updates and RM1363

-- 
*Harshal Dhumal*
*Software Engineer*

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

On Tue, Jun 14, 2016 at 10:40 PM, Dave Page <dp...@pgadmin.org> wrote:

> On Tue, Jun 14, 2016 at 5:28 PM, Dave Page <dp...@pgadmin.org> wrote:
> > Thanks - committed with some minor changes:
> >
> > - Move the password field under the user name.
> >
> > - Remove the password requirement. The user might be using "trust" auth.
> >
> > - Adjust the vertical positioning of the checkbox.
>
> Hmm, this is actually broken:
>
> 1) I've left the password check in the Python code.
>
Removed check


>
> 2) It seems like it saves the server info on the first connection
> attempt. That means that if the connection fails, but the password is
> not the issue (mis-typed address or username perhaps), correcting that
> info doesn't allow the connection to proceed.
>
Fixed


>
> Because of 2, I haven't fixed 1 (you'll probably need to move it
> around anyway). Essentially, we need to support password-less
> connections, and if the connection fails, the user should be able to
> immediately try again having changed any of the connection options.
>

Added support for password less login


>
> Please take a look - and while you're in that code, please take a look
> at #1363. It's probably a very simple fix.
>

Fxied


>
> Thanks.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: 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 a658b29..9e7b5c8 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -526,7 +526,7 @@ class ServerNode(PGChildNodeView):
                 'port': server.port,
                 'db': server.maintenance_db,
                 'username': server.username,
-                'gid': server.servergroup_id,
+                'gid': str(server.servergroup_id),
                 'group-name': sg.name,
                 'comment': server.comment,
                 'role': server.role,
@@ -582,22 +582,23 @@ class ServerNode(PGChildNodeView):
             user = None
 
             if 'connect_now' in data and data['connect_now']:
-                if 'password' not in data or data["password"] == '':
-                    db.session.delete(server)
-                    db.session.commit()
-                    raise Exception("No password provided.")
-
-                password = data['password']
-                password = encrypt(password, current_user.password)
-
                 from pgadmin.utils.driver import get_driver
                 manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(server.id)
+                manager.update(server)
                 conn = manager.connection()
 
+                if 'password' in data and data["password"] != '':
+                    # login with password
+                    password = data['password']
+                    password = encrypt(password, current_user.password)
+                else:
+                    # Attempt password less login
+                    password = None
+
                 status, errmsg = conn.connect(
-                        password=password,
-                        server_types=ServerType.types()
-                        )
+                            password=password,
+                            server_types=ServerType.types()
+                            )
 
                 if not status:
                     db.session.delete(server)
@@ -626,6 +627,10 @@ class ServerNode(PGChildNodeView):
                     )
 
         except Exception as e:
+            if server:
+                db.session.delete(server)
+                db.session.commit()
+
             current_app.logger.exception(e)
             return make_json_response(
                 status=410,
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to