aboutsummaryrefslogblamecommitdiffstats
path: root/alphabetlearning/payments/forms.py
blob: 68acfeebcb974be036f294ad69aa16d96b2d771a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                        


                                                        



                                             

                                                        

                                 
                          

                          
                                              

                                                                                
                    
from django import forms
from django_recaptcha.fields import ReCaptchaField
from django_recaptcha.widgets import ReCaptchaV2Checkbox

from .models import EmailVerification


class EmailVerificationForm(forms.ModelForm):
    captcha = ReCaptchaField(widget=ReCaptchaV2Checkbox)

    class Meta:
        model = EmailVerification
        fields = ["email"]

    def clean_email(self):
        email = self.cleaned_data.get("email")
        if EmailVerification.objects.filter(email=email).exists():
            raise forms.ValidationError("This email address is already in use.")
        return email