upgrade wtform

This commit is contained in:
TuxCoder 2022-06-17 09:25:14 +02:00
parent 8287b01e40
commit 4105974fe0
4 changed files with 13 additions and 13 deletions

View file

@ -1,11 +1,11 @@
from flask_babel import gettext
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextField, \
from wtforms import StringField, SubmitField, \
TextAreaField, PasswordField, IntegerField, FloatField, \
DateTimeField, DateField, FormField, BooleanField, \
SelectField, Form as NoCsrfForm, SelectMultipleField
from wtforms.fields.html5 import URLField
from wtforms.fields import URLField
from wtforms.fields import FormField, SelectMultipleField
from .base import FieldList

View file

@ -1,12 +1,12 @@
from flask_babel import gettext
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextField, \
from wtforms import StringField, SubmitField, \
TextAreaField, PasswordField, IntegerField, FloatField, \
DateTimeField, DateField, FormField, BooleanField, \
SelectField, Form as NoCsrfForm, SelectMultipleField, \
HiddenField
from wtforms.fields.html5 import EmailField
from wtforms.widgets.html5 import NumberInput, DateInput
from wtforms.fields import EmailField
from wtforms.widgets import NumberInput, DateInput
from wtforms.validators import DataRequired, NumberRange, Optional, NoneOf, Length, Regexp, InputRequired
from datetime import datetime
@ -22,7 +22,7 @@ class PasswordForm(FlaskForm):
class TotpForm(FlaskForm):
totp = TextField(gettext('2FA Token'))
totp = StringField(gettext('2FA Token'))
submit = SubmitField(gettext('Authorize'))
@ -32,7 +32,7 @@ class WebauthnLoginForm(FlaskForm):
assertion = HiddenField('Assertion', [InputRequired()])
class Fido2Form(FlaskForm):
fido2 = TextField(gettext('Fido2'), default="Javascript Required")
fido2 = StringField(gettext('Fido2'), default="Javascript Required")
submit = SubmitField(gettext('Authorize'))

View file

@ -1,10 +1,10 @@
from flask_babel import gettext
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextField, \
from wtforms import StringField, SubmitField, \
TextAreaField, PasswordField, IntegerField, FloatField, \
DateTimeField, DateField, FormField, BooleanField, \
SelectField, Form as NoCsrfForm, HiddenField
from wtforms.widgets.html5 import NumberInput, DateInput
from wtforms.widgets import NumberInput, DateInput
from wtforms.validators import DataRequired, NumberRange, \
Optional, NoneOf, Length, EqualTo, InputRequired
@ -25,8 +25,8 @@ class ClientCertForm(FlaskForm):
class TOTPForm(FlaskForm):
secret = HiddenField(gettext('totp-Secret'))
token = TextField(gettext('totp-verify token'))
name = TextField(gettext('name'))
token = StringField(gettext('totp-verify token'))
name = StringField(gettext('name'))
submit = SubmitField(gettext('Activate'))

View file

@ -44,8 +44,8 @@ window.fieldlist = {
var template = templateTag.content.cloneNode(true);
var id = templateTag.dataset['fieldlistNextId']++;
for(let tag of template.querySelectorAll('[name], [id]')){
tag.name = tag.name.replace(/^custom-/, name+'-'+id+'-')
tag.id = tag.id.replace(/^custom-/, name+'-'+id+'-')
tag.name = tag.name.replace(/^custom/, `${name}-${id}`)
tag.id = tag.id.replace(/^custom/, `${name}-${id}`)
};
templateTag.parentNode.querySelector('ul').appendChild(template);