summaryrefslogtreecommitdiffstats
path: root/ogcp/forms
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2022-04-26 17:16:52 +0200
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-04-27 17:27:50 +0200
commit661254b76edd51c36090edd0f898bdca16f23277 (patch)
tree7882d0097515358435206a795d4f8b815965f529 /ogcp/forms
parentd8bac16a980634f182e9c753a01e114c3a482af0 (diff)
Add 'Add user' to Users section
Creates "Add user" form with the following inputs: username, password, password confirmation, role (administrator or regular), allowed scopes.
Diffstat (limited to 'ogcp/forms')
-rw-r--r--ogcp/forms/auth.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/ogcp/forms/auth.py b/ogcp/forms/auth.py
index c02ecc7..b10d8fe 100644
--- a/ogcp/forms/auth.py
+++ b/ogcp/forms/auth.py
@@ -7,7 +7,7 @@
from wtforms import (
Form, SubmitField, HiddenField, SelectField, BooleanField, IntegerField,
- StringField, RadioField, PasswordField
+ StringField, RadioField, PasswordField, SelectMultipleField
)
from wtforms.validators import InputRequired
from flask_wtf import FlaskForm
@@ -28,3 +28,32 @@ class LoginForm(FlaskForm):
submit_btn = SubmitField(
label=_l('Login')
)
+
+
+class UserForm(FlaskForm):
+ username = StringField(
+ label=_l('Username'),
+ validators=[InputRequired()]
+ )
+ pwd = PasswordField(
+ label=_l('Password'),
+ )
+ pwd_hash = HiddenField(
+ validators=[InputRequired()]
+ )
+ pwd_confirm = PasswordField(
+ label=_l('Repeat password'),
+ )
+ pwd_hash_confirm = HiddenField(
+ validators=[InputRequired()]
+ )
+ admin = BooleanField(
+ label=_l('Administrator'),
+ )
+ scopes = SelectMultipleField(
+ label=_l('Allowed scopes'),
+ description=_l('Leave this empty to give full permissions'),
+ )
+ submit_btn = SubmitField(
+ label=_l('Submit')
+ )