Hi,
PFA patch for user management issues.
--
*Harshal Dhumal*
*Software Engineer*
EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Mon, Jun 6, 2016 at 6:06 PM, Dave Page <[email protected]> wrote:
> Hi
>
> Thanks - I've commit as-is (with some minor tweaks), however the
> following issues are present:
>
> 1) I get an error: "Invalid Email id: [email protected]". That is a
> perfectly valid email address, but I guess we're not recognising the
> +.
>
Fixed.
>
> 2) When I mouse-over the Users menu option, the cursor isn't changing
> to a pointer.
>
Fixed.
>
> 3) The font in the Close button is still not quite the same as for the
> other dialogues.
>
Fixed font size issue.
>
> Please fix and submit patch(es).
>
> Thanks.
>
> On Mon, Jun 6, 2016 at 11:58 AM, Harshal Dhumal
> <[email protected]> wrote:
> > Hi,
> >
> > PFA updated patch (V6) for user management functionality.
> >
> > Changes: As per Ashesh's suggestion I have disabled email update of
> existing
> > user.
> >
> >
> > --
> > Harshal Dhumal
> > Software Engineer
> >
> > EnterpriseDB India: http://www.enterprisedb.com
> > The Enterprise PostgreSQL Company
> >
> > On Mon, Jun 6, 2016 at 2:16 PM, Dave Page <[email protected]> wrote:
> >>
> >> Hi
> >>
> >> On Fri, Jun 3, 2016 at 10:52 PM, Harshal Dhumal
> >> <[email protected]> wrote:
> >> > Hi,
> >> >
> >> >
> >> > PFA attached patch (V5) for user management functionality.
> >> >
> >> > Note: If you've applied any of the previous patch of this
> functionality
> >> > then
> >> > set ConfigDB value to 10 in version table of and also delete role
> >> > 'Standard'
> >> > from role table before applying this patch.
> >>
> >> Done - also restarted my app server, and done a hard refresh of the
> >> browser...
> >>
> >> And I get "(index):310 Uncaught TypeError: Cannot read property
> >> 'show_users' of undefined" when I try to open the Users menu option.
> >
> >
> > This was an issue. Ideally Users menu shouldn't be visible to non admin
> > users. I have fixed in this patch.
> >
> >>
> >>
> >> >> - The Close button should be disabled if errors are present.
> >> >
> >> >
> >> > I'm not convinced that to deny superuser from closing dialog for his
> >> > mistakes (accidental mistakes).
> >> >
> >> > Consider a case when superuser clears email for any old user
> >> > inadvertently
> >> > (obviously this won't reflect on server). At this point there is no
> >> > proper
> >> > way that he can roll back or close the dialog without saving it if we
> >> > disable close button. He has to either enter correct email for that
> user
> >> > or
> >> > refresh the browser.
> >> >
> >> > Another case while adding new user if he plans not to add user then he
> >> > has
> >> > to clear that partially filled user from grid before he can close the
> >> > dialog.
> >>
> >> Well we either need that, or a message box asking the user if he wants
> >> to discard his changes and offering OK/Cancel options.
> >
> >
> > I have added confirmation before closing dialog if any unsaved changes
> are
> > present.
> >
> >
> >>
> >>
> >> >> - If I enter all the details for a new user and then hit Close, the
> >> >> dialog
> >> >> is closed and the new user is NOT added. I have to click something
> else
> >> >> first so the row loses focus, and then click close.
> >> >
> >> >
> >> > I was not able to reproduce this issue. I tried with both close
> buttons
> >> > (top-right and bottom-right). Users were created in both the cases by
> >> > adding
> >> > all details and directly closing dialog without clicking anywhere on
> the
> >> > dialog.
> >>
> >> Hmm, I'll re-test when I get an updated patch.
> >
> > Ok
> >
> >>
> >>
> >> --
> >> Dave Page
> >> Blog: http://pgsnake.blogspot.com
> >> Twitter: @pgsnake
> >>
> >> EnterpriseDB UK: http://www.enterprisedb.com
> >> The Enterprise PostgreSQL Company
> >
> >
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/browser/templates/browser/index.html b/web/pgadmin/browser/templates/browser/index.html
index a70cb5b..69d3ecc 100644
--- a/web/pgadmin/browser/templates/browser/index.html
+++ b/web/pgadmin/browser/templates/browser/index.html
@@ -69,7 +69,7 @@ try {
<li><a href="{{ url_for('security.change_password') }}">{{ _('Change Password') }}</a></li>
<li class="divider"></li>
{% if is_admin %}
- <li><a onclick="pgAdmin.Browser.UserManagement.show_users()">{{ _('Users') }}</a></li>
+ <li><a href="#" onclick="pgAdmin.Browser.UserManagement.show_users()">{{ _('Users') }}</a></li>
<li class="divider"></li>
{% endif %}
<li><a href="{{ url_for('security.logout') }}">{{ _('Logout') }}</a></li>
diff --git a/web/pgadmin/static/css/overrides.css b/web/pgadmin/static/css/overrides.css
index 3cb7dc8..02f0e02 100755
--- a/web/pgadmin/static/css/overrides.css
+++ b/web/pgadmin/static/css/overrides.css
@@ -1103,7 +1103,7 @@ span.button-label {
}
button.pg-alertify-button {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
- font-size: 15px;
+ font-size: 14px;
}
.fa.pg-alertify-button:before {
font: normal normal normal 18px/1 FontAwesome;
@@ -1319,10 +1319,10 @@ height: calc(100% - 35px);
font-size: 12px;
}
-.user_management-pg-alertify-button {
- font-size: 14px !important;
-}
-
.alertify_tools_dialog_backgrid_properties {
top: 43px !important;
+}
+
+.user_management_pg-alertify-button {
+ line-height: 16px;
}
\ No newline at end of file
diff --git a/web/pgadmin/tools/user_management/__init__.py b/web/pgadmin/tools/user_management/__init__.py
index 278a7d5..85d61d9 100644
--- a/web/pgadmin/tools/user_management/__init__.py
+++ b/web/pgadmin/tools/user_management/__init__.py
@@ -66,7 +66,10 @@ blueprint = UserManagementModule(
def validate_user(data):
new_data = dict()
- email_filter = '^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$'
+ email_filter = re.compile("^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9]"
+ "(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9]"
+ "(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
+
if ('newPassword' in data and data['newPassword'] != "" and
'confirmPassword' in data and data['confirmPassword'] != ""):
@@ -76,7 +79,7 @@ def validate_user(data):
raise Exception(_("Passwords do not match."))
if 'email' in data and data['email'] != "":
- if re.match(email_filter, data['email']):
+ if email_filter.match(data['email']):
new_data['email'] = data['email']
else:
raise Exception(_("Invalid email address."))
diff --git a/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js b/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js
index 96acd9d..7fb54bd 100644
--- a/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js
+++ b/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js
@@ -157,7 +157,7 @@ define([
var err = {},
errmsg = null,
changedAttrs = this.changed || {},
- email_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
+ email_filter = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
if (('email' in changedAttrs || !this.isNew()) && (_.isUndefined(this.get('email')) ||
_.isNull(this.get('email')) ||
@@ -377,8 +377,8 @@ define([
setup:function() {
return {
buttons: [{
- text: '{{ _('Close') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button',
- attrs:{name:'close'}
+ text: '{{ _('Close') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button user_management_pg-alertify-button',
+ attrs:{name:'close', type:'button'}
}],
// Set options for dialog
options: {
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers