コード例 #1
0
ファイル: authenticate.py プロジェクト: iamyogesh/foodem
    def clean(self):

        user = authenticate (
            username = self.cleaned_data.get('username'),
            password = self.cleaned_data.get('password')
        )

        if user == None or (
            not user.is_superuser
            and user.userprofile.site != self.site
        ):
            logger.debug(self.site)
            raise forms.ValidationError("Invalid username/password")

        elif not user.is_active:
            raise forms.ValidationError("Account has been disabled")

        elif (
            not user.userprofile.submitted
            and not user.userprofile.validated
        ):
            raise forms.ValidationError("You must validate your email before you can log in.  Check your inbox for your validation instructions email.")

        elif not user.get_profile().approved:
            raise forms.ValidationError("Account awaiting approval")

        return super(AuthForm, self).clean()
コード例 #2
0
ファイル: authenticate.py プロジェクト: iamyogesh/foodem
 def process_request(self, request):
     if request.path_info[0:5] == '/mobile-request/':
         logger.debug("Skipping session")
         return
     super(SessionMiddlewareOverride, self).process_request(request)