From 30f405bb88aa9188ca6e44cf79844bd8c46d858c Mon Sep 17 00:00:00 2001 From: Stephan Porada <sporada@uni-bielefeld.de> Date: Thu, 11 Jul 2019 15:43:48 +0200 Subject: [PATCH] Add some docstrings --- app/auth/forms.py | 4 ++++ app/auth/views.py | 7 +++++++ app/main/views.py | 3 +++ 3 files changed, 14 insertions(+) diff --git a/app/auth/forms.py b/app/auth/forms.py index 0e54ebf7..576c4b00 100644 --- a/app/auth/forms.py +++ b/app/auth/forms.py @@ -48,6 +48,10 @@ class PasswordResetRequestForm(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()]) username = StringField('Username', validators=[ diff --git a/app/auth/views.py b/app/auth/views.py index b0223e06..c8154cd4 100644 --- a/app/auth/views.py +++ b/app/auth/views.py @@ -66,6 +66,10 @@ def confirm(token): @auth.before_app_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 \ and not current_user.confirmed \ and request.blueprint != 'auth' \ @@ -128,6 +132,9 @@ def password_reset(token): @auth.route('/settings', methods=['GET', 'POST']) @login_required def settings(): + """ + View where loged in User can change own User information like Password etc. + """ form = ChangeAccountForm() if form.validate_on_submit(): flash('It is just a test, nothing changed.') diff --git a/app/main/views.py b/app/main/views.py index f801f2ad..64d36be4 100644 --- a/app/main/views.py +++ b/app/main/views.py @@ -15,6 +15,9 @@ def index(): @login_required @admin_required def for_admins_only(): + """ + View for admin page only accesible by admins. + """ users = User.query.order_by(User.username).all() items = [AdminUserItem(u.username, u.email, u.role_id, u.confirmed) for u in users] table = AdminUserTable(items) -- GitLab