Fix email validation and mouse pointer over the Users option.

This commit is contained in:
Harshal Dhumal 2016-06-07 09:24:44 +01:00 committed by Dave Page
parent e4f21568ad
commit f3fae9d238
3 changed files with 9 additions and 6 deletions

View File

@ -69,7 +69,7 @@ try {
<li><a href="{{ url_for('security.change_password') }}">{{ _('Change Password') }}</a></li> <li><a href="{{ url_for('security.change_password') }}">{{ _('Change Password') }}</a></li>
<li class="divider"></li> <li class="divider"></li>
{% if is_admin %} {% 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> <li class="divider"></li>
{% endif %} {% endif %}
<li><a href="{{ url_for('security.logout') }}">{{ _('Logout') }}</a></li> <li><a href="{{ url_for('security.logout') }}">{{ _('Logout') }}</a></li>

View File

@ -66,7 +66,10 @@ blueprint = UserManagementModule(
def validate_user(data): def validate_user(data):
new_data = dict() 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 if ('newPassword' in data and data['newPassword'] != "" and
'confirmPassword' in data and data['confirmPassword'] != ""): 'confirmPassword' in data and data['confirmPassword'] != ""):
@ -76,7 +79,7 @@ def validate_user(data):
raise Exception(_("Passwords do not match.")) raise Exception(_("Passwords do not match."))
if 'email' in data and data['email'] != "": 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'] new_data['email'] = data['email']
else: else:
raise Exception(_("Invalid email address.")) raise Exception(_("Invalid email address."))

View File

@ -157,7 +157,7 @@ define([
var err = {}, var err = {},
errmsg = null, errmsg = null,
changedAttrs = this.changed || {}, 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')) || if (('email' in changedAttrs || !this.isNew()) && (_.isUndefined(this.get('email')) ||
_.isNull(this.get('email')) || _.isNull(this.get('email')) ||
@ -377,8 +377,8 @@ define([
setup:function() { setup:function() {
return { return {
buttons: [{ buttons: [{
text: '{{ _('Close') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button', text: '{{ _('Close') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button user_management_pg-alertify-button',
attrs:{name:'close'} attrs:{name:'close', type:'button'}
}], }],
// Set options for dialog // Set options for dialog
options: { options: {