added hr accounts only to register form

This commit is contained in:
crunk 2022-03-27 18:20:47 +02:00
parent b193582c8a
commit b3f7e1fb6f
2 changed files with 19 additions and 7 deletions

View File

@ -6,12 +6,17 @@ from wtforms import (
) )
from wtforms import validators from wtforms import validators
from wtforms.validators import Length, Email, EqualTo from wtforms.validators import Length, Email, EqualTo, ValidationError
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
class RegisterForm(FlaskForm): class RegisterForm(FlaskForm):
"""Register for distribusi-verse form class""" """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 = StringField(
"Username:", "Username:",
validators=[validators.InputRequired(), Length(3, 150)], validators=[validators.InputRequired(), Length(3, 150)],
@ -19,12 +24,19 @@ class RegisterForm(FlaskForm):
email = StringField( email = StringField(
"Email address:", "Email address:",
validators=[validators.InputRequired(), Email(), Length(6, 64)], validators=[
validators.InputRequired(),
Email(),
Length(6, 64),
hremail,
]
) )
password = PasswordField( password = PasswordField(
"New password:", "New password:",
validators=[validators.InputRequired(), Length(12, 72)], validators=[validators.InputRequired(), Length(12, 72)],
) )
confirmpassword = PasswordField( confirmpassword = PasswordField(
"Confirm your password:", "Confirm your password:",
validators=[ validators=[

View File

@ -70,7 +70,7 @@ the following html in your distribusi page:</p>
&lt;/div&gt;</pre> &lt;/div&gt;</pre>
<p>The encapsulating <strong>div</strong> tag gets an id that is the same as the <p>The encapsulating <strong>div</strong> tag gets an id that is the same as the
<em>file name.</em> The <strong>img</strong> tag gets a class attribute <em>image</em> <em>file name.</em> The <strong>img</strong> tag gets a class attribute <em>image</em>
This is handy for styling your files with css (See 5.)</p> This is handy for styling your files with CSS (See 5.)</p>
<hr> <hr>
<h3>3. Folders become links and pages</h3> <h3>3. Folders become links and pages</h3>
<p>When you make your zipfile, this zipfile can contain folders with more <p>When you make your zipfile, this zipfile can contain folders with more
@ -83,7 +83,7 @@ same style. </p>
&lt;/div&gt;</pre> &lt;/div&gt;</pre>
<p>The encapsulating <strong>div</strong> tag gets an id <p>The encapsulating <strong>div</strong> tag gets an id
<em>folder.</em> and a class attribute <em>dir</em> <em>folder.</em> and a class attribute <em>dir</em>
This is handy for styling your files with css (See 5.)</p> This is handy for styling your files with CSS (See 5.)</p>
<p>the anchor <em>(a)</em> tag will get an href attribute pointing to the <p>the anchor <em>(a)</em> tag will get an href attribute pointing to the
subfolder</p> subfolder</p>
<hr> <hr>
@ -100,16 +100,16 @@ add simple text elements to their pages.</p>
&lt;/div&gt;</pre> &lt;/div&gt;</pre>
<p>The encapsulating <strong>div</strong> tag gets an id that is the same as the <p>The encapsulating <strong>div</strong> tag gets an id that is the same as the
<em>file name.</em> and a class attribute <em>plain</em> <em>file name.</em> and a class attribute <em>plain</em>
This is handy for styling your files with css (See 5.)</p> This is handy for styling your files with CSS (See 5.)</p>
<hr> <hr>
<h3>5. Use Css to style your page</h3> <h3>5. Use CSS to style your page</h3>
<p>Distribusi offers almost full support for styling your page with CSS. <p>Distribusi offers almost full support for styling your page with CSS.
Because all content is auto generated your CSS will be placed in a Because all content is auto generated your CSS will be placed in a
style tag in the head of each HTML file.</p> style tag in the head of each HTML file.</p>
<p>Distrbusi-verse allows its users to skip this step by just selecting a basic <p>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 <em>public.</em> theme or by selecting one of the themes other users have made <em>public.</em>
<p>Alternatively a user can opt to make their own custom theme, either in a <p>Alternatively a user can opt to make their own custom theme, either in a
simple online editor or by uploading their own Css file.</p> simple online editor or by uploading their own CSS file.</p>
<hr> <hr>
</div> </div>
{% endblock %} {% endblock %}