mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixes #1110 - Proper validation for the security labels.
This commit is contained in:
parent
e3ab4501d5
commit
9ed2530b1f
@ -95,7 +95,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
}
|
||||
},{
|
||||
id: 'spcuser', label:'{{ _('Owner') }}', cell: 'string',
|
||||
type: 'text', control: 'node-list-by-name', node: 'role'
|
||||
type: 'text', control: 'node-list-by-name', node: 'role',
|
||||
select2: {allowClear: false}
|
||||
},{
|
||||
id: 'acl', label: '{{ _('Privileges') }}', type: 'text',
|
||||
group: '{{ _('Security') }}', mode: ['properties'], disabled: true
|
||||
@ -128,14 +129,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
errmsg = null,
|
||||
changedAttrs = this.sessAttrs,
|
||||
msg = undefined;
|
||||
if (_.has(changedAttrs, 'name') &&
|
||||
(_.isUndefined(this.get('name'))
|
||||
|| String(this.get('name')).replace(/^\s+|\s+$/g, '') == '')) {
|
||||
if (_.isUndefined(this.get('name'))
|
||||
|| String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') {
|
||||
msg = '{{ _('Name cannot be empty.') }}';
|
||||
this.errorModel.set('name', msg);
|
||||
} else if (_.has(changedAttrs, 'spclocation') &&
|
||||
(_.isUndefined(this.get('spclocation'))
|
||||
|| String(this.get('spclocation')).replace(/^\s+|\s+$/g, '') == '')) {
|
||||
} else if (_.isUndefined(this.get('spclocation'))
|
||||
|| String(this.get('spclocation')).replace(/^\s+|\s+$/g, '') == '') {
|
||||
msg = '{{ _('Location cannot be empty.') }}';
|
||||
this.errorModel.set('spclocation', msg);
|
||||
} else {
|
||||
|
@ -20,15 +20,26 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
}],
|
||||
validate: function() {
|
||||
var err = {},
|
||||
errmsg = null,
|
||||
data = this.toJSON();
|
||||
errmsg = null;
|
||||
this.errorModel.clear();
|
||||
|
||||
if (_.isUndefined(data.label) ||
|
||||
_.isNull(data.label) ||
|
||||
String(data.label).replace(/^\s+|\s+$/g, '') == '') {
|
||||
return _("Please specify the value for all the security providers.");
|
||||
}
|
||||
return null;
|
||||
if (_.isUndefined(this.get('provider')) ||
|
||||
_.isNull(this.get('provider')) ||
|
||||
String(this.get('provider')).replace(/^\s+|\s+$/g, '') == '') {
|
||||
errmsg = '{{ _('Provider must be specified.') }}';
|
||||
this.errorModel.set('provider', errmsg);
|
||||
return errmsg;
|
||||
}
|
||||
|
||||
if (_.isUndefined(this.get('label')) ||
|
||||
_.isNull(this.get('label')) ||
|
||||
String(this.get('label')).replace(/^\s+|\s+$/g, '') == '') {
|
||||
errmsg = '{{ _('Label must be specified.') }}';
|
||||
this.errorModel.set('label', errmsg);
|
||||
return errmsg;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user