Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect maximum length of webadmin and webclient form fields #539

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions omeroweb/webadmin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@ def __init__(self, *args, **kwargs):
self.field_order = ["server", "username", "password"]

username = forms.CharField(
max_length=50,
max_length=255,
widget=forms.TextInput(attrs={"size": 22, "autofocus": "autofocus"}),
)
password = forms.CharField(
max_length=50,
widget=forms.PasswordInput(attrs={"size": 22, "autocomplete": "off"}),
)

Expand All @@ -67,7 +66,7 @@ def __init__(self, *args, **kwargs):
super(ForgottonPasswordForm, self).__init__(*args, **kwargs)
self.fields["server"] = ServerModelChoiceField(Server, empty_label=None)
f = forms.CharField(
max_length=50,
chris-allan marked this conversation as resolved.
Show resolved Hide resolved
max_length=255,
widget=forms.TextInput(attrs={"size": 28, "autocomplete": "off"}),
)
self.fields["username"] = f
Expand Down Expand Up @@ -147,11 +146,9 @@ def __init__(

if "with_password" in kwargs["initial"] and kwargs["initial"]["with_password"]:
self.fields["password"] = forms.CharField(
max_length=50,
widget=forms.PasswordInput(attrs={"size": 30, "autocomplete": "off"}),
)
self.fields["confirmation"] = forms.CharField(
max_length=50,
widget=forms.PasswordInput(attrs={"size": 30, "autocomplete": "off"}),
)

Expand Down Expand Up @@ -239,29 +236,29 @@ def __init__(
field.widget.attrs["disabled"] = True

omename = OmeNameField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
label="Username",
)
first_name = forms.CharField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
)
middle_name = forms.CharField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
required=False,
)
last_name = forms.CharField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
)
email = forms.EmailField(
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
required=False,
)
institution = forms.CharField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
required=False,
)
Expand Down Expand Up @@ -334,11 +331,10 @@ def __init__(
self.name_check = name_check
if can_modify_group:
self.fields["name"] = forms.CharField(
max_length=100,
max_length=255,
widget=forms.TextInput(attrs={"size": 25, "autocomplete": "off"}),
)
self.fields["description"] = forms.CharField(
max_length=250,
required=False,
widget=forms.TextInput(attrs={"size": 25, "autocomplete": "off"}),
)
Expand Down Expand Up @@ -470,31 +466,32 @@ def __init__(self, email_check=False, *args, **kwargs):
]

omename = forms.CharField(
max_length=50,
max_length=255,
widget=forms.TextInput(
attrs={"onfocus": "this.blur()", "size": 30, "autocomplete": "off"}
),
label="Username",
)
first_name = forms.CharField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
)
middle_name = forms.CharField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
required=False,
)
last_name = forms.CharField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
)
email = forms.EmailField(
max_length=255,
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
required=False,
)
institution = forms.CharField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30, "autocomplete": "off"}),
required=False,
)
Expand Down Expand Up @@ -547,17 +544,14 @@ def clean_photo(self):

class ChangePassword(forms.Form):
old_password = forms.CharField(
max_length=50,
widget=forms.PasswordInput(attrs={"size": 30, "autocomplete": "off"}),
label="Current password",
)
password = forms.CharField(
max_length=50,
widget=forms.PasswordInput(attrs={"size": 30, "autocomplete": "off"}),
label="New password",
)
confirmation = forms.CharField(
max_length=50,
widget=forms.PasswordInput(attrs={"size": 30, "autocomplete": "off"}),
label="Confirm password",
)
Expand All @@ -578,7 +572,7 @@ def clean_confirmation(self):

class EnumerationEntry(forms.Form):
new_entry = forms.CharField(
max_length=250, widget=forms.TextInput(attrs={"size": 30})
max_length=255, widget=forms.TextInput(attrs={"size": 30})
)


Expand All @@ -589,20 +583,20 @@ def __init__(self, entries, *args, **kwargs):
try:
if kwargs["initial"]["entries"]:
self.fields[str(e.id)] = forms.CharField(
max_length=250,
max_length=255,
initial=e.value,
widget=forms.TextInput(attrs={"size": 30}),
label=i + 1,
)
else:
self.fields[str(e.id)] = forms.CharField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30}),
label=i + 1,
)
except Exception:
self.fields[str(e.id)] = forms.CharField(
max_length=250,
max_length=255,
widget=forms.TextInput(attrs={"size": 30}),
label=i + 1,
)
Expand Down
Loading
Loading