Make the 'Password' and 'Save Password' options visible in edit mode in the Server Dialog.
parent
82730da392
commit
8046c238d8
|
|
@ -744,6 +744,8 @@ class ServerNode(PGChildNodeView):
|
|||
'port': 'port',
|
||||
'db': 'maintenance_db',
|
||||
'username': 'username',
|
||||
'password': 'password',
|
||||
'save_password': 'save_password',
|
||||
'gid': 'servergroup_id',
|
||||
'comment': 'comment',
|
||||
'role': 'role',
|
||||
|
|
@ -877,9 +879,16 @@ class ServerNode(PGChildNodeView):
|
|||
sharedserver):
|
||||
|
||||
idx = 0
|
||||
|
||||
crypt_key_present, crypt_key = get_crypt_key()
|
||||
if not crypt_key_present:
|
||||
raise CryptKeyMissing
|
||||
|
||||
for arg in config_param_map:
|
||||
if arg in data:
|
||||
value = data[arg]
|
||||
if arg == 'password':
|
||||
value = encrypt(data[arg], crypt_key)
|
||||
# sqlite3 do not have boolean type so we need to convert
|
||||
# it manually to integer
|
||||
if 'shared' in data and not data['shared']:
|
||||
|
|
@ -1020,6 +1029,8 @@ class ServerNode(PGChildNodeView):
|
|||
'host': server.host,
|
||||
'port': server.port,
|
||||
'db': server.maintenance_db,
|
||||
'password': server.password,
|
||||
'save_password': server.save_password,
|
||||
'shared': server.shared if config.SERVER_MODE else None,
|
||||
'shared_username': server.shared_username
|
||||
if config.SERVER_MODE else None,
|
||||
|
|
|
|||
|
|
@ -348,22 +348,25 @@ export default class ServerSchema extends BaseUISchema {
|
|||
},{
|
||||
id: 'password', label: gettext('Password'), type: 'password',
|
||||
group: gettext('Connection'),
|
||||
mode: ['create'],
|
||||
deps: ['connect_now', 'kerberos_conn'],
|
||||
visible: function(state) {
|
||||
return state.connect_now && obj.isNew(state);
|
||||
},
|
||||
mode: ['create', 'edit'],
|
||||
deps: ['kerberos_conn', 'save_password'],
|
||||
controlProps: {
|
||||
maxLength: null,
|
||||
autoComplete: 'new-password'
|
||||
},
|
||||
readonly: function(state) {
|
||||
if (obj.isNew())
|
||||
return false;
|
||||
return state.connected || !state.save_password;
|
||||
},
|
||||
disabled: function(state) {return state.kerberos_conn;},
|
||||
helpMessage: gettext('In edit mode the password field is enabled only if Save Password is set to true.')
|
||||
},{
|
||||
id: 'save_password', label: gettext('Save password?'),
|
||||
type: 'switch', group: gettext('Connection'), mode: ['create'],
|
||||
deps: ['connect_now', 'kerberos_conn'],
|
||||
visible: function(state) {
|
||||
return state.connect_now && obj.isNew(state);
|
||||
type: 'switch', group: gettext('Connection'), mode: ['create', 'edit'],
|
||||
deps: ['kerberos_conn'],
|
||||
readonly: function(state) {
|
||||
return state.connected;
|
||||
},
|
||||
disabled: function(state) {
|
||||
return !current_user.allow_save_password || state.kerberos_conn;
|
||||
|
|
|
|||
Loading…
Reference in New Issue