From b3f7e1fb6ffbf5acd226f6a76ed22c740910ac56 Mon Sep 17 00:00:00 2001
From: crunk
Date: Sun, 27 Mar 2022 18:20:47 +0200
Subject: [PATCH] added hr accounts only to register form
---
verse/forms/registerform.py | 16 ++++++++++++++--
verse/templates/help.html | 10 +++++-----
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/verse/forms/registerform.py b/verse/forms/registerform.py
index cfedac9..7a8d1b1 100644
--- a/verse/forms/registerform.py
+++ b/verse/forms/registerform.py
@@ -6,12 +6,17 @@ from wtforms import (
)
from wtforms import validators
-from wtforms.validators import Length, Email, EqualTo
+from wtforms.validators import Length, Email, EqualTo, ValidationError
from flask_wtf import FlaskForm
class RegisterForm(FlaskForm):
"""Register for distribusi-verse form class"""
+
+ def hremail(form, field):
+ if not field.data.endswith("@hr.nl"):
+ raise ValidationError("Only HRO accounts are allowed.")
+
username = StringField(
"Username:",
validators=[validators.InputRequired(), Length(3, 150)],
@@ -19,12 +24,19 @@ class RegisterForm(FlaskForm):
email = StringField(
"Email address:",
- validators=[validators.InputRequired(), Email(), Length(6, 64)],
+ validators=[
+ validators.InputRequired(),
+ Email(),
+ Length(6, 64),
+ hremail,
+ ]
)
+
password = PasswordField(
"New password:",
validators=[validators.InputRequired(), Length(12, 72)],
)
+
confirmpassword = PasswordField(
"Confirm your password:",
validators=[
diff --git a/verse/templates/help.html b/verse/templates/help.html
index 61db4e3..cadd573 100644
--- a/verse/templates/help.html
+++ b/verse/templates/help.html
@@ -70,7 +70,7 @@ the following html in your distribusi page:
</div>
The encapsulating div tag gets an id that is the same as the
file name. The img tag gets a class attribute image
-This is handy for styling your files with css (See 5.)
+This is handy for styling your files with CSS (See 5.)
3. Folders become links and pages
When you make your zipfile, this zipfile can contain folders with more
@@ -83,7 +83,7 @@ same style.
</div>
The encapsulating div tag gets an id
folder. and a class attribute dir
-This is handy for styling your files with css (See 5.)
+This is handy for styling your files with CSS (See 5.)
the anchor (a) tag will get an href attribute pointing to the
subfolder
@@ -100,16 +100,16 @@ add simple text elements to their pages.
</div>
The encapsulating div tag gets an id that is the same as the
file name. and a class attribute plain
-This is handy for styling your files with css (See 5.)
+This is handy for styling your files with CSS (See 5.)
- 5. Use Css to style your page
+ 5. Use CSS to style your page
Distribusi offers almost full support for styling your page with CSS.
Because all content is auto generated your CSS will be placed in a
style tag in the head of each HTML file.
Distrbusi-verse allows its users to skip this step by just selecting a basic
theme or by selecting one of the themes other users have made public.
Alternatively a user can opt to make their own custom theme, either in a
-simple online editor or by uploading their own Css file.
+simple online editor or by uploading their own CSS file.
{% endblock %}