mirror of
https://github.com/moepman/bk-dss
synced 2024-12-22 12:44:27 +01:00
Use FlaskForm instead of deprecated Form.
This commit is contained in:
parent
187bfe4f42
commit
2a616874d8
8
dss.py
8
dss.py
@ -5,7 +5,7 @@ import ldap.modlist
|
|||||||
import uuid
|
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 FlaskForm
|
||||||
from wtforms.fields import IntegerField, PasswordField, SelectField, StringField, SubmitField
|
from wtforms.fields import IntegerField, PasswordField, SelectField, StringField, SubmitField
|
||||||
from wtforms.validators import EqualTo, DataRequired
|
from wtforms.validators import EqualTo, DataRequired
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class ReadOnlyField(StringField):
|
|||||||
kwargs.setdefault('readonly', True)
|
kwargs.setdefault('readonly', True)
|
||||||
return super(ReadOnlyField, self).__call__(*args, **kwargs)
|
return super(ReadOnlyField, self).__call__(*args, **kwargs)
|
||||||
|
|
||||||
class CreateForm(Form):
|
class CreateForm(FlaskForm):
|
||||||
user = StringField('Username', validators = [DataRequired()])
|
user = StringField('Username', validators = [DataRequired()])
|
||||||
uid = IntegerField('User ID', validators = [DataRequired()])
|
uid = IntegerField('User ID', validators = [DataRequired()])
|
||||||
gn = StringField('Given Name', validators = [DataRequired()])
|
gn = StringField('Given Name', validators = [DataRequired()])
|
||||||
@ -39,13 +39,13 @@ class CreateForm(Form):
|
|||||||
pwd2 = PasswordField('Password (repeat)', validators = [DataRequired(), 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(FlaskForm):
|
||||||
user = ReadOnlyField('Username')
|
user = ReadOnlyField('Username')
|
||||||
pwd1 = PasswordField('New Password', validators = [DataRequired()])
|
pwd1 = PasswordField('New Password', validators = [DataRequired()])
|
||||||
pwd2 = PasswordField('New Password (repeat)', validators = [DataRequired(), 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(FlaskForm):
|
||||||
user = StringField('Username', validators=[DataRequired()])
|
user = StringField('Username', validators=[DataRequired()])
|
||||||
pswd = PasswordField('Password', validators=[DataRequired()])
|
pswd = PasswordField('Password', validators=[DataRequired()])
|
||||||
submit = SubmitField('Login')
|
submit = SubmitField('Login')
|
||||||
|
Loading…
Reference in New Issue
Block a user