mama_cas/forms.py
def clean(self):
        """
        Pass the provided username and password to the active
        authentication backends and verify the user account is
        not disabled. If authentication succeeds, the ``User`` object
        is assigned to the form so it can be accessed in the view.
        """
        username = self.cleaned_data.get('username')
        password = self.cleaned_data.get('password')

        if username and password:
            try:
                self.user = authenticate(request=self.request, username=username, password=password)
            except Exception:
                logger.exception("Error authenticating %s" % username)
                error_msg = _('Internal error while authenticating user')
                raise forms.ValidationError(error_msg)

            if self.user is None:
                logger.warning("Failed authentication for %s" % username)
                error_msg = _('The username or password is not correct')
                raise forms.ValidationError(error_msg)
            else:
                if not self.user.is_active:
                    logger.warning("User account %s is disabled" % username)
                    error_msg = _('This user account is disabled')
                    raise forms.ValidationError(error_msg)

        return self.cleaned_data

        Pass the provided username and password to the active
        authentication backends and verify the user account is
        not disabled. If authentication succeeds, the ``User`` object
        is assigned to the form so it can be accessed in the view.
        
Pass the provided username and password to the active
authentication backends and verify the user account is
not disabled. If authentication succeeds, the ``User`` object
is assigned to the form so it can be accessed in the view.
Pass the provided username and password to the active authentication backends and verify the user account is not disabled . If authentication succeeds the ` ` User ` ` object is assigned to the form so it can be accessed in the view .
def clean(self):
        username = self.cleaned_data.get('username')
        password = self.cleaned_data.get('password')
        if username and password:
            try:
                self.user = authenticate(request=self.request, username=username, password=password)
            except Exception:
                logger.exception("Error authenticating %s" % username)
                error_msg = _('Internal error while authenticating user')
                raise forms.ValidationError(error_msg)
            if self.user is None:
                logger.warning("Failed authentication for %s" % username)
                error_msg = _('The username or password is not correct')
                raise forms.ValidationError(error_msg)
            else:
                if not self.user.is_active:
                    logger.warning("User account %s is disabled" % username)
                    error_msg = _('This user account is disabled')
                    raise forms.ValidationError(error_msg)
        return self.cleaned_data
def clean ( self ) : username = self . cleaned_data . get ( 'username' ) password = self . cleaned_data . get ( 'password' ) if username and password : try : self . user = authenticate ( request = self . request , username = username , password = password ) except Exception : logger . exception ( "Error authenticating %s" % username ) error_msg = _ ( 'Internal error while authenticating user' ) raise forms . ValidationError ( error_msg ) if self . user is None : logger . warning ( "Failed authentication for %s" % username ) error_msg = _ ( 'The username or password is not correct' ) raise forms . ValidationError ( error_msg ) else : if not self . user . is_active : logger . warning ( "User account %s is disabled" % username ) error_msg = _ ( 'This user account is disabled' ) raise forms . ValidationError ( error_msg ) return self . cleaned_data
Pass the provided username and password to the active
authentication backends and verify the user account is
not disabled.
Pass the provided username and password to the active authentication backends and verify the user account is not disabled .
"""
        Pass the provided username and password to the active
        authentication backends and verify the user account is
        not disabled. If authentication succeeds, the ``User`` object
        is assigned to the form so it can be accessed in the view.
        """
self