Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for # more details. # # You should have received a copy of the GNU General Public License version 3 # along with this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # (c) 2015-2016 Valentin Samir
""" Bases: :class:`django.forms.Form`
Form base class to use boostrap then rendering the form fields """ # Only tweak the field if it will be displayed isinstance(field.widget, (widgets.Input, widgets.Select, widgets.Textarea)) and not isinstance(field.widget, (widgets.CheckboxInput,)) ):
""" Bases: :class:`BootsrapForm`
Base form with all field possibly hidden on the login pages """ #: The service url for which the user want a ticket #: A valid LoginTicket to prevent POST replay #: Is the service asking the authentication renewal ? #: Url to redirect to if the authentication fail (user not authenticated or bad service)
""" Bases: :class:`BaseLogin`
Form used on warn page before emiting a ticket """ #: ``True`` if the user has been warned of the ticket emission
""" Bases: :class:`BaseLogin`
Form used on the login page when ``settings.CAS_FEDERATE`` is ``True`` allowing the user to choose an identity provider. """ #: The providers the user can choose to be used as authentication backend queryset=models.FederatedIendityProvider.objects.filter(display=True).order_by( "pos", "verbose_name", "suffix" ), to_field_name="suffix", label=_('Identity provider'), ) #: A checkbox to ask to be warn before emiting a ticket for another service label=_('Warn me before logging me into other sites.'), required=False ) #: A checkbox to remember the user choices of :attr:`provider<FederateSelect.provider>`
""" Bases: :class:`BaseLogin`
Form used on the login page to retrive user credentials """ #: The user username label=_('username'), widget=forms.TextInput(attrs={'autofocus': 'autofocus'}) ) #: The user password #: A checkbox to ask to be warn before emiting a ticket for another service label=_('Warn me before logging me into other sites.'), required=False )
""" Validate that the submited :attr:`username` and :attr:`password` are valid
:raises django.forms.ValidationError: if the :attr:`username` and :attr:`password` are not valid. :return: The cleaned POST data :rtype: dict """ else: _(u"The credentials you provided cannot be determined to be authentic.") )
""" Bases: :class:`UserCredential`
Form used on a auto submited page for linking the views :class:`FederateAuth<cas_server.views.FederateAuth>` and :class:`LoginView<cas_server.views.LoginView>`.
On successful authentication on a provider, in the view :class:`FederateAuth<cas_server.views.FederateAuth>` a :class:`FederatedUser<cas_server.models.FederatedUser>` is created by :meth:`cas_server.federate.CASFederateValidateUser.verify_ticket` and the user is redirected to :class:`LoginView<cas_server.views.LoginView>`. This form is then automatically filled with infos matching the created :class:`FederatedUser<cas_server.models.FederatedUser>` using the ``ticket`` as one time password and submited using javascript. If javascript is not enabled, a connect button is displayed.
This stub authentication form, allow to implement the federated mode with very few modificatons to the :class:`LoginView<cas_server.views.LoginView>` view. """
# All fields are hidden and auto filled by the /login view logic
""" Validate that the submited :attr:`username` and :attr:`password` are valid using the :class:`CASFederateAuth<cas_server.auth.CASFederateAuth>` auth class.
:raises django.forms.ValidationError: if the :attr:`username` and :attr:`password` do not correspond to a :class:`FederatedUser<cas_server.models.FederatedUser>`. :return: The cleaned POST data :rtype: dict """ # should not happed as if the FederatedUser do not exists, super should # raise before a ValidationError("bad user") except models.FederatedUser.DoesNotExist: # pragma: no cover (should not happend) raise forms.ValidationError( _(u"User not found in the temporary database, please try to reconnect") )
""" Bases: :class:`django.forms.ModelForm`
Form for Tickets in the admin interface """ |