From c7900e5b1e2651a28410d13dfa58c37701b65692 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Wed, 31 Jul 2019 17:49:41 +0100 Subject: Add terms and conditions to registration page --- app/auth/forms.py | 4 +++- app/auth/routes.py | 41 +++++++++++++++++++++++++++++++++++++++- app/templates/auth/register.html | 17 ++++++++++++++++- 3 files changed, 59 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/auth/forms.py b/app/auth/forms.py index 7758342..ea194a5 100644 --- a/app/auth/forms.py +++ b/app/auth/forms.py @@ -3,7 +3,7 @@ from flask import current_app from flask_wtf import FlaskForm -from wtforms import StringField, PasswordField, SubmitField +from wtforms import StringField, PasswordField, SubmitField, BooleanField from wtforms.validators import DataRequired, ValidationError, Email, EqualTo from app.models import User @@ -22,6 +22,8 @@ class RegistrationForm(FlaskForm): password2 = PasswordField( "Repeat Password", validators=[DataRequired(), EqualTo("password")] ) + toc = BooleanField("I agree to the Terms and Conditions.", + validators=[DataRequired(), ]) submit = SubmitField("Register") def validate_username(self, username): diff --git a/app/auth/routes.py b/app/auth/routes.py index 2a8a0bd..aa44e7d 100644 --- a/app/auth/routes.py +++ b/app/auth/routes.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- import datetime +import markdown +import textwrap from flask import ( render_template, @@ -32,6 +34,41 @@ from app.models import User, Task from app.utils.tasks import generate_user_task +LEGAL = markdown.markdown( + textwrap.dedent( + """ + ## Terms and Conditions + + The AnnotateChange application is created to construct a data set for + the analysis of change point algorithms. As a user, you will be asked + to annotate time series data. It is important that we can use these + annotations freely and publish them under a permissive license. + + Therefore, we ask that you agree to the following terms and conditions. + + 1. Identifiable user data such as email address, password, and IP + address will not be shared by us with any third party, unless we are + required to do so by law. This information will only be used to provide + authentication to the application and verify that you have access to + the email address you provide us. + + 2. Annotations and any other information you provide us through use of + the application are provided to us under a worldwide, royalty-free, + non-exclusive, and perpetual license and can be made publically + available by us under a permissive license and used for whatever + purpose we see fit. In any publication of this annotation data users + will only be identified by a numeric ID, not by personal identifiable + information (such as email or IP address). + + 3. You agree that you will not revoke or seek invalidation of any + license that you have granted under these Terms and conditions for any + content you have provided us. + + """ + ) +) + + def auto_logout(): # Automatically logout after a period of inactivity # https://stackoverflow.com/a/40914886/1154005 @@ -109,7 +146,9 @@ def register(): ) return redirect(url_for("auth.login")) - return render_template("auth/register.html", title="Register", form=form) + return render_template( + "auth/register.html", title="Register", form=form, legal=LEGAL + ) @bp.route("/reset_password_request", methods=("GET", "POST")) diff --git a/app/templates/auth/register.html b/app/templates/auth/register.html index c430b38..e2a49a1 100644 --- a/app/templates/auth/register.html +++ b/app/templates/auth/register.html @@ -1,11 +1,26 @@ {% extends "base.html" %} {% import 'bootstrap/wtf.html' as wtf %} +{% block styles %} + {{ super() }} + +{% endblock %} + {% block app_content %}

Register

-
+
+

Registration Form

{{ wtf.quick_form(form) }}
+
+
+
{% endblock %} -- cgit v1.2.3