diff --git a/web/pgadmin/browser/templates/browser/index.html b/web/pgadmin/browser/templates/browser/index.html index a70cb5b36..69d3ecce3 100644 --- a/web/pgadmin/browser/templates/browser/index.html +++ b/web/pgadmin/browser/templates/browser/index.html @@ -69,7 +69,7 @@ try {
  • {{ _('Change Password') }}
  • {% if is_admin %} -
  • {{ _('Users') }}
  • +
  • {{ _('Users') }}
  • {% endif %}
  • {{ _('Logout') }}
  • diff --git a/web/pgadmin/tools/user_management/__init__.py b/web/pgadmin/tools/user_management/__init__.py index 278a7d55a..85d61d94b 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 96acd9df9..7fb54bdc3 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: {