susioma/frontend/forms.py

10 lines
343 B
Python
Raw Permalink Normal View History

2019-10-27 15:20:28 +00:00
from django import forms
from django.core.exceptions import ValidationError
from smsauth.views import useToken
def validateToken(value):
if not useToken(value):
raise ValidationError("Der eingegebene Code ist ungültig.")
class SMSAuthForm(forms.Form):
token = forms.IntegerField(max_value=999999, validators=[validateToken])