expephalon-kumisms/core/forms/auth.py

23 lines
708 B
Python
Raw Normal View History

from django.forms import Form, EmailField, CharField, PasswordInput, ChoiceField
from core.helpers.otp import get_otp_choices
class LoginForm(Form):
email = EmailField()
password = CharField(widget=PasswordInput)
class OTPSelectorForm(Form):
def __init__(self, *args, **kwargs):
otp_choices = kwargs.pop('otp_choices', [])
super(OTPSelectorForm, self).__init__(*args, **kwargs)
self.fields['provider'] = ChoiceField(choices=otp_choices)
class OTPVerificationForm(Form):
token = CharField()
class PWResetForm(Form):
password1 = CharField(widget=PasswordInput)
password2 = CharField(widget=PasswordInput)
class PWRequestForm(Form):
email = EmailField()