1
0
mirror of https://github.com/moepman/bk-dss synced 2024-12-22 18:24:27 +01:00

dss.py: Use DataRequired() instead of Required()

Required() is deprecated.

Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
Ralf Ramsauer 2018-09-17 21:14:53 +02:00
parent d2f1b94964
commit be150eb06f

22
dss.py
View File

@ -7,7 +7,7 @@ import uuid
from flask import Flask, render_template, redirect, url_for, session from flask import Flask, render_template, redirect, url_for, session
from flask_wtf import Form from flask_wtf import Form
from wtforms.fields import IntegerField, PasswordField, SelectField, StringField, SubmitField from wtforms.fields import IntegerField, PasswordField, SelectField, StringField, SubmitField
from wtforms.validators import EqualTo, Required from wtforms.validators import EqualTo, DataRequired
from passlib.hash import ldap_salted_sha1 from passlib.hash import ldap_salted_sha1
from redis import Redis from redis import Redis
@ -31,23 +31,23 @@ class ReadOnlyField(StringField):
return super(ReadOnlyField, self).__call__(*args, **kwargs) return super(ReadOnlyField, self).__call__(*args, **kwargs)
class CreateForm(Form): class CreateForm(Form):
user = StringField('Username', validators = [Required()]) user = StringField('Username', validators = [DataRequired()])
uid = IntegerField('User ID', validators = [Required()]) uid = IntegerField('User ID', validators = [DataRequired()])
gn = StringField('Given Name', validators = [Required()]) gn = StringField('Given Name', validators = [DataRequired()])
sn = StringField('Family Name', validators = [Required()]) sn = StringField('Family Name', validators = [DataRequired()])
pwd1 = PasswordField('Password', validators = [Required()]) pwd1 = PasswordField('Password', validators = [DataRequired()])
pwd2 = PasswordField('Password (repeat)', validators = [Required(), EqualTo('pwd1', "Passwords must match")]) pwd2 = PasswordField('Password (repeat)', validators = [DataRequired(), EqualTo('pwd1', "Passwords must match")])
submit = SubmitField('Submit') submit = SubmitField('Submit')
class EditForm(Form): class EditForm(Form):
user = ReadOnlyField('Username') user = ReadOnlyField('Username')
pwd1 = PasswordField('New Password', validators = [Required()]) pwd1 = PasswordField('New Password', validators = [DataRequired()])
pwd2 = PasswordField('New Password (repeat)', validators = [Required(), EqualTo('pwd1', "Passwords must match")]) pwd2 = PasswordField('New Password (repeat)', validators = [DataRequired(), EqualTo('pwd1', "Passwords must match")])
submit = SubmitField('Submit') submit = SubmitField('Submit')
class LoginForm(Form): class LoginForm(Form):
user = StringField('Username', validators=[Required()]) user = StringField('Username', validators=[DataRequired()])
pswd = PasswordField('Password', validators=[Required()]) pswd = PasswordField('Password', validators=[DataRequired()])
submit = SubmitField('Login') submit = SubmitField('Login')