mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Add save password option in sever create mode. Fixes #1450
Do a little string/layout cleanup whilst passing.
This commit is contained in:
committed by
Dave Page
parent
68497b00f6
commit
dfceb63986
@@ -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()
|
||||
|
||||
have_password = False
|
||||
if 'password' in data and data["password"] != '':
|
||||
# login with password
|
||||
have_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 have_password:
|
||||
setattr(server, 'password', password)
|
||||
db.session.commit()
|
||||
|
||||
user = manager.user_info
|
||||
connected = True
|
||||
icon = "icon-pg"
|
||||
|
||||
Reference in New Issue
Block a user