mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix role valid until date handling. Fixes #1107
This commit is contained in:
parent
d5a91c969c
commit
fcd33162a9
@ -133,6 +133,20 @@ class RoleView(PGChildNodeView):
|
||||
_("Name must be specified.")
|
||||
)
|
||||
|
||||
if u'rolvaliduntil' in data:
|
||||
# Make date explicit so that it works with every
|
||||
# postgres database datestyle format
|
||||
try:
|
||||
if data[u'rolvaliduntil'] is not None:
|
||||
date = datetime.datetime.strptime(
|
||||
data[u'rolvaliduntil'], '%m/%d/%Y'
|
||||
)
|
||||
data[u'rolvaliduntil'] = date.strftime("%d-%B-%Y")
|
||||
except Exception as e:
|
||||
return precondition_required(
|
||||
_("Date format is invalid.")
|
||||
)
|
||||
|
||||
if u'rolconnlimit' in data:
|
||||
if data[u'rolconnlimit'] is not None:
|
||||
data[u'rolconnlimit'] = int(data[u'rolconnlimit'])
|
||||
|
@ -403,10 +403,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) {
|
||||
return false;
|
||||
}
|
||||
},{
|
||||
id: 'rolvaliduntil', disabled: 'readonly', type: 'date',
|
||||
id: 'rolvaliduntil', disabled: 'readonly', type: 'text',
|
||||
group: '{{ _('Definition') }}', label: '{{ _('Account Expires') }}',
|
||||
cell: 'string', mode: ['properties', 'edit', 'create'], retype: true,
|
||||
deps: ['rolcanlogin'], options: {}
|
||||
deps: ['rolcanlogin'], options: {}, control: 'datepicker'
|
||||
},{
|
||||
id: 'rolconnlimit', type: 'int', group: '{{ _('Definition') }}',
|
||||
label: '{{ _('Connection Limit') }}', cell: 'number',
|
||||
|
Loading…
Reference in New Issue
Block a user