mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
Add some docstrings
This commit is contained in:
parent
4918d185c2
commit
30f405bb88
@ -48,6 +48,10 @@ class PasswordResetRequestForm(FlaskForm):
|
|||||||
|
|
||||||
|
|
||||||
class ChangeAccountForm(FlaskForm):
|
class ChangeAccountForm(FlaskForm):
|
||||||
|
"""
|
||||||
|
Form to change information of currently logged in User. User can change
|
||||||
|
informations about him on his own.
|
||||||
|
"""
|
||||||
email = StringField('Email', validators=[Optional(), Length(1, 64),
|
email = StringField('Email', validators=[Optional(), Length(1, 64),
|
||||||
Email()])
|
Email()])
|
||||||
username = StringField('Username', validators=[
|
username = StringField('Username', validators=[
|
||||||
|
@ -66,6 +66,10 @@ def confirm(token):
|
|||||||
|
|
||||||
@auth.before_app_request
|
@auth.before_app_request
|
||||||
def before_request():
|
def before_request():
|
||||||
|
"""
|
||||||
|
Checks if a user is unconfirmed when visiting specific sites. Redirects to
|
||||||
|
unconfirmed view if user is unconfirmed.
|
||||||
|
"""
|
||||||
if current_user.is_authenticated \
|
if current_user.is_authenticated \
|
||||||
and not current_user.confirmed \
|
and not current_user.confirmed \
|
||||||
and request.blueprint != 'auth' \
|
and request.blueprint != 'auth' \
|
||||||
@ -128,6 +132,9 @@ def password_reset(token):
|
|||||||
@auth.route('/settings', methods=['GET', 'POST'])
|
@auth.route('/settings', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def settings():
|
def settings():
|
||||||
|
"""
|
||||||
|
View where loged in User can change own User information like Password etc.
|
||||||
|
"""
|
||||||
form = ChangeAccountForm()
|
form = ChangeAccountForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
flash('It is just a test, nothing changed.')
|
flash('It is just a test, nothing changed.')
|
||||||
|
@ -15,6 +15,9 @@ def index():
|
|||||||
@login_required
|
@login_required
|
||||||
@admin_required
|
@admin_required
|
||||||
def for_admins_only():
|
def for_admins_only():
|
||||||
|
"""
|
||||||
|
View for admin page only accesible by admins.
|
||||||
|
"""
|
||||||
users = User.query.order_by(User.username).all()
|
users = User.query.order_by(User.username).all()
|
||||||
items = [AdminUserItem(u.username, u.email, u.role_id, u.confirmed) for u in users]
|
items = [AdminUserItem(u.username, u.email, u.role_id, u.confirmed) for u in users]
|
||||||
table = AdminUserTable(items)
|
table = AdminUserTable(items)
|
||||||
|
Loading…
Reference in New Issue
Block a user