Commit 6fbdf3f8 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos

Removed 2 fields from InstServer and renamed port to auth_port. Changed...

Removed 2 fields from InstServer and renamed port to auth_port. Changed template and forms accordingly
parent 3b8ea0e1
......@@ -67,12 +67,12 @@ class InstServerForm(forms.ModelForm):
else:
raise forms.ValidationError('This field is required.')
def clean_port(self):
port = self.cleaned_data['port']
def clean_auth_port(self):
auth_port = self.cleaned_data['auth_port']
institution = self.cleaned_data['instid']
if institution.ertype in [1,3]:
if port:
return self.cleaned_data["port"]
if auth_port:
return self.cleaned_data["auth_port"]
else:
raise forms.ValidationError(_('This field is required.'))
......@@ -84,32 +84,12 @@ class InstServerForm(forms.ModelForm):
return self.cleaned_data["acct_port"]
else:
raise forms.ValidationError(_('This field is required.'))
def clean_timeout(self):
timeout = self.cleaned_data['timeout']
institution = self.cleaned_data['instid']
if institution.ertype in [1,3]:
if timeout:
return self.cleaned_data["timeout"]
else:
raise forms.ValidationError(_('This field is required.'))
def clean_retry(self):
retry = self.cleaned_data['retry']
institution = self.cleaned_data['instid']
if institution.ertype in [1,3]:
if retry:
return self.cleaned_data["retry"]
else:
raise forms.ValidationError(_('This field is required.'))
def clean_host(self):
host = self.cleaned_data['host']
if host:
match = re.match(FQDN_RE, host)
if not match:
print "not match"
try:
address = ipaddr.IPNetwork(host)
except Exception:
......
......@@ -228,10 +228,8 @@ class InstServer(models.Model):
host = models.CharField(max_length=80, help_text=_("IP address | FQDN hostname")) # Handling with FQDN parser or ipaddr (google lib) * !!! Add help text to render it in template (mandatory, unique)
#TODO: Add description field or label field
# accept if type: 1 (idp) or 3 (idpsp) (for the folowing 4 fields)
port = models.PositiveIntegerField(max_length=5, null=True, blank=True, default=1812, help_text=_("Defaul for Radius: 1812")) # TODO: Also ignore while exporting XML
acct_port = models.PositiveIntegerField(max_length=5, null=True, blank=True, default=1813, help_text=_("Defaul for Radius: 1813"))
timeout = models.PositiveIntegerField(max_length=2, null=True, blank=True, help_text=_("Timeout in seconds"))
retry = models.PositiveIntegerField(max_length=2, null=True, blank=True)
auth_port = models.PositiveIntegerField(max_length=5, null=True, blank=True, default=1812, help_text=_("Default for RADIUS: 1812")) # TODO: Also ignore while exporting XML
acct_port = models.PositiveIntegerField(max_length=5, null=True, blank=True, default=1813, help_text=_("Default for RADIUS: 1813"))
status_server = models.BooleanField(help_text=_("Do you accept Status-Server requests?"))
secret = models.CharField(max_length=80)
......
This diff is collapsed.
......@@ -55,12 +55,12 @@ $(document).ready(function() {
</div>
</div>
{% if institution.ertype == 1 or institution.ertype == 3 %}
<div class="control-group {% if form.port.errors %} error {% endif %}">
<label class="control-label" for="id_port"><b>{% trans "Port" %}</b></label>
<div class="control-group {% if form.auth_port.errors %} error {% endif %}">
<label class="control-label" for="id_auth_port"><b>{% trans "Auth Port" %}</b></label>
<div class="controls">
{{ form.port }}
{% if form.port.errors %} <span class="help-inline"> {{ form.port.errors|join:", " }} </span>
{% endif %} <span class="help-block">{{ form.port.help_text }}</span>
{{ form.auth_port }}
{% if form.auth_port.errors %} <span class="help-inline"> {{ form.auth_port.errors|join:", " }} </span>
{% endif %} <span class="help-block">{{ form.auth_port.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.acct_port.errors %} error {% endif %}">
......@@ -71,22 +71,6 @@ $(document).ready(function() {
{% endif %} <span class="help-block">{{ form.acct_port.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.timeout.errors %} error {% endif %}">
<label class="control-label" for="id_timeout"><b>{% trans "Timeout" %}</b></label>
<div class="controls">
{{ form.timeout }}
{% if form.timeout.errors %} <span class="help-inline"> {{ form.timeout.errors|join:", " }} </span>
{% endif %} <span class="help-block">{{ form.timeout.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.retry.errors %} error {% endif %}">
<label class="control-label" for="id_retry"><b>{% trans "Retry" %}</b></label>
<div class="controls">
{{ form.retry }}
{% if form.retry.errors %} <span class="help-inline"> {{ form.retry.errors|join:", " }} </span>
{% endif %} <span class="help-block">{{ form.retry.help_text }}</span>
</div>
</div>
{% endif %}
<div class="control-group {% if form.status_server.errors %} error {% endif %}">
<label class="control-label" for="id_status_server">{% trans "Status-Server" %}</label>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment