Skip to content

Commit 541ff3a

Browse files
wlorenzettiwlorenzetti
andauthored
Fix update user data (#1016)
Co-authored-by: wlorenzetti <lorenzett@gis3w.it>
1 parent a7b2a34 commit 541ff3a

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{% load crispy_forms_field %}
2+
3+
{% if field.is_hidden %}
4+
{{ field }}
5+
{% else %}
6+
<div id="div_{{ field.auto_id }}" class="form-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} has-error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
7+
8+
{% if field.label and form_show_labels %}
9+
<label for="{{ field.id_for_label }}" class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
10+
{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
11+
</label>
12+
{% endif %}
13+
14+
<div class="controls {{ field_class }}">
15+
<div class="input-group">
16+
{% if crispy_prepended_text %}<span class="input-group-addon{% if active %} active{% endif %}{% if input_size %} {{ input_size }}{% endif %}">{{ crispy_prepended_text|safe }}</span>{% endif %}
17+
{% crispy_field field 'class' 'form-control' %}
18+
{% if crispy_appended_text %}<span class="input-group-addon{% if active %} active{% endif %}{% if input_size %} {{ input_size }}{% endif %}">{{ crispy_appended_text|safe }}</span>{% endif %}
19+
</div>
20+
21+
{% include 'bootstrap3/layout/help_text_and_errors.html' %}
22+
</div>
23+
</div>
24+
{% endif %}

g3w-admin/usersmanage/forms.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,12 @@ class G3WUserUpdateForm(G3WUserForm):
724724

725725
password = ReadOnlyPasswordHashField()
726726

727+
def clean_username(self):
728+
"""Reject usernames that differ only in case."""
729+
username = self.cleaned_data.get("username")
730+
731+
return username
732+
727733
def clean_password(self):
728734
return self.initial['password']
729735

0 commit comments

Comments
 (0)