providers/saml: move field labels from Form into models
This commit is contained in:
parent
e5b85e8e6a
commit
bdd1863177
|
@ -44,10 +44,6 @@ class SAMLProviderForm(forms.ModelForm):
|
||||||
"signing_cert",
|
"signing_cert",
|
||||||
"signing_key",
|
"signing_key",
|
||||||
]
|
]
|
||||||
labels = {
|
|
||||||
"acs_url": "ACS URL",
|
|
||||||
"signing_cert": "Singing Certificate",
|
|
||||||
}
|
|
||||||
widgets = {
|
widgets = {
|
||||||
"name": forms.TextInput(),
|
"name": forms.TextInput(),
|
||||||
"audience": forms.TextInput(),
|
"audience": forms.TextInput(),
|
||||||
|
@ -72,6 +68,3 @@ class SAMLPropertyMappingForm(forms.ModelForm):
|
||||||
"friendly_name": forms.TextInput(),
|
"friendly_name": forms.TextInput(),
|
||||||
}
|
}
|
||||||
field_classes = {"values": DynamicArrayField}
|
field_classes = {"values": DynamicArrayField}
|
||||||
help_texts = {
|
|
||||||
"values": 'String substitution uses a syntax like "{variable} test}".'
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from django.contrib.postgres.fields import ArrayField
|
from django.contrib.postgres.fields import ArrayField
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from structlog import get_logger
|
from structlog import get_logger
|
||||||
|
|
||||||
from passbook.core.models import PropertyMapping, Provider
|
from passbook.core.models import PropertyMapping, Provider
|
||||||
|
@ -19,7 +19,7 @@ class SAMLProvider(Provider):
|
||||||
name = models.TextField()
|
name = models.TextField()
|
||||||
processor_path = models.CharField(max_length=255, choices=[])
|
processor_path = models.CharField(max_length=255, choices=[])
|
||||||
|
|
||||||
acs_url = models.URLField()
|
acs_url = models.URLField(verbose_name=_("ACS URL"))
|
||||||
audience = models.TextField(default="")
|
audience = models.TextField(default="")
|
||||||
issuer = models.TextField()
|
issuer = models.TextField()
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class SAMLProvider(Provider):
|
||||||
)
|
)
|
||||||
|
|
||||||
signing = models.BooleanField(default=True)
|
signing = models.BooleanField(default=True)
|
||||||
signing_cert = models.TextField()
|
signing_cert = models.TextField(verbose_name=_("Singing Certificate"))
|
||||||
signing_key = models.TextField()
|
signing_key = models.TextField()
|
||||||
|
|
||||||
form = "passbook.providers.saml.forms.SAMLProviderForm"
|
form = "passbook.providers.saml.forms.SAMLProviderForm"
|
||||||
|
@ -100,9 +100,17 @@ class SAMLProvider(Provider):
|
||||||
class SAMLPropertyMapping(PropertyMapping):
|
class SAMLPropertyMapping(PropertyMapping):
|
||||||
"""SAML Property mapping, allowing Name/FriendlyName mapping to a list of strings"""
|
"""SAML Property mapping, allowing Name/FriendlyName mapping to a list of strings"""
|
||||||
|
|
||||||
saml_name = models.TextField()
|
saml_name = models.TextField(verbose_name="SAML Name")
|
||||||
friendly_name = models.TextField(default=None, blank=True, null=True)
|
friendly_name = models.TextField(default=None, blank=True, null=True)
|
||||||
values = ArrayField(models.TextField())
|
values = ArrayField(
|
||||||
|
models.TextField(),
|
||||||
|
help_text=_(
|
||||||
|
(
|
||||||
|
"This string can contain string substitutions delimited by {}."
|
||||||
|
" The following Variables are available: user, request"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
form = "passbook.providers.saml.forms.SAMLPropertyMappingForm"
|
form = "passbook.providers.saml.forms.SAMLPropertyMappingForm"
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.contrib.auth import logout
|
||||||
from django.contrib.auth.mixins import AccessMixin
|
from django.contrib.auth.mixins import AccessMixin
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.validators import URLValidator
|
from django.core.validators import URLValidator
|
||||||
from django.http import HttpResponse, HttpResponseBadRequest, HttpRequest
|
from django.http import HttpRequest, HttpResponse, HttpResponseBadRequest
|
||||||
from django.shortcuts import get_object_or_404, redirect, render, reverse
|
from django.shortcuts import get_object_or_404, redirect, render, reverse
|
||||||
from django.utils.datastructures import MultiValueDictKeyError
|
from django.utils.datastructures import MultiValueDictKeyError
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
|
Reference in New Issue