public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nikhil Mohite <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM-6120]: Adding/updating user should not allow to add an older date in account expires.
Date: Thu, 14 Jan 2021 11:28:10 +0530
Message-ID: <CAOBg0AMsjjfovd9tpdikhwrqYMq_v51jNyqPQFc1WofxjaDU_Q@mail.gmail.com> (raw)
Hi Team,
Please find the attached patch for RM-6120
<https://redmine.postgresql.org/issues/6120;: Adding/updating user should
not allow to add an older date in account expires.
Added UI validation if a user enters the account expiration date manually.
--
*Thanks & Regards,*
*Nikhil Mohite*
*Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*
Attachments:
[application/octet-stream] RM_6120.patch (1.6K, 3-RM_6120.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js b/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js
index 68909fd8..2f957f53 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js
+++ b/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js
@@ -562,6 +562,29 @@ define('pgadmin.node.role', [
}
}
+ //Check Account expiration should not be less that current selected date.
+ let currdate = null;
+ let oldDate = null;
+ if(this.get('rolvaliduntil') != this.origSessAttrs.rolvaliduntil && this.get('rolvaliduntil') != '' && this.origSessAttrs.rolvaliduntil != 'infinity') {
+ currdate = new Date(this.get('rolvaliduntil'));
+ oldDate = new Date(this.origSessAttrs.rolvaliduntil);
+ } else if (this.origSessAttrs.rolvaliduntil == 'infinity') {
+ if(this.get('rolvaliduntil') == '') {
+ let $el = this.panelEl.find('.datetimepicker-input');
+ currdate = $el.data('datetimepicker').date().clone()._d;
+ } else {
+ currdate = new Date(this.get('rolvaliduntil'));
+ }
+ oldDate = new Date();
+ oldDate.setHours(0,0,0,0);
+ }
+
+ if(currdate < oldDate) {
+ err['rolvaliduntil'] = gettext('Account expiration date can’t be older than current date');
+ errmsg = gettext('Account expiration date can’t be older than current date');
+ }
+
+
this.errorModel.clear().set(err);
if (_.size(err)) {
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin][RM-6120]: Adding/updating user should not allow to add an older date in account expires.
In-Reply-To: <CAOBg0AMsjjfovd9tpdikhwrqYMq_v51jNyqPQFc1WofxjaDU_Q@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox