From 4105974fe0533df65de7f9022a102048a3cf7e01 Mon Sep 17 00:00:00 2001 From: TuxCoder Date: Fri, 17 Jun 2022 09:25:14 +0200 Subject: [PATCH] upgrade wtform --- lenticular_cloud/form/admin.py | 4 ++-- lenticular_cloud/form/auth.py | 10 +++++----- lenticular_cloud/form/frontend.py | 8 ++++---- lenticular_cloud/template/skelet.html.j2 | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lenticular_cloud/form/admin.py b/lenticular_cloud/form/admin.py index 70b4952..7b98e00 100644 --- a/lenticular_cloud/form/admin.py +++ b/lenticular_cloud/form/admin.py @@ -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 diff --git a/lenticular_cloud/form/auth.py b/lenticular_cloud/form/auth.py index 1c36117..bc3712d 100644 --- a/lenticular_cloud/form/auth.py +++ b/lenticular_cloud/form/auth.py @@ -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')) diff --git a/lenticular_cloud/form/frontend.py b/lenticular_cloud/form/frontend.py index 32ebb51..6e9c26e 100644 --- a/lenticular_cloud/form/frontend.py +++ b/lenticular_cloud/form/frontend.py @@ -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')) diff --git a/lenticular_cloud/template/skelet.html.j2 b/lenticular_cloud/template/skelet.html.j2 index 4240241..a372141 100644 --- a/lenticular_cloud/template/skelet.html.j2 +++ b/lenticular_cloud/template/skelet.html.j2 @@ -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);