10 lines
343 B
Python
10 lines
343 B
Python
|
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])
|