M app.py => app.py +3 -1
@@ 27,10 27,12 @@ if not app.config["SECRET_KEY"]:
app.config["db"] = SQLAlchemy(app)
with app.app_context():
- from auth.views import auth
from flatpages.views import flatpages
app.register_blueprint(flatpages)
+
+ from auth.views import auth
+
app.register_blueprint(auth, subdomain="auth")
M auth/forms.py => auth/forms.py +8 -1
@@ 2,7 2,8 @@
#
# SPDX-License-Identifier: AGPL-3.0-only
-from wtforms import Form, PasswordField, StringField
+from flask import Markup, url_for
+from wtforms import BooleanField, Form, PasswordField, StringField
from wtforms.validators import Email, EqualTo, InputRequired, Length, Regexp
from wtforms.widgets import TextArea
@@ 32,3 33,9 @@ class RegistrationForm(Form):
)
password2 = PasswordField("Password (confirm)", [InputRequired()])
bio = StringField("Biography", [InputRequired()], widget=TextArea())
+ tos = BooleanField(
+ Markup(
+ f'I have read the <a href="{url_for("flatpages.privacy")}">privacy policy</a> and agree to follow the <a href="{url_for("flatpages.coc")}">code of conduct</a>.'
+ ),
+ [InputRequired()],
+ )
M auth/templates/register.html => auth/templates/register.html +2 -0
@@ 29,5 29,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0
<small>Let us know a bit about yourself and why you want an account. Leave it informal, we'll keep it private.</small>
<input type="submit" value="Register">
+
+ {{ input(form.tos) }}
</form>
{% endblock %}
M flatpages/templates/privacy.html => flatpages/templates/privacy.html +1 -1
@@ 25,7 25,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0
<p><b>Notice</b>: Because of the multi-party nature of communications, other users participating or observing conversations or content you publish on this site or its services may keep logs or archives of it for any period of time.</p>
<h2>Data Removal</h2>
- <p>Any data associated with your account will be deleted when you delete your account.</p>
+ <p>Any data associated with your account, with the exception of your username, will be deleted when you delete your account. Your username will be kept in the database for the same length of time as our access logs (60 days), preventing others from registering it, before it will be removed and others will be able to register it again.</p>
<p>For any additional requests to remove data, please <a href="{{ url_for("flatpages.contact") }}">contact us here</a>.
<h2>Third Parties</h2>
M static/style.css => static/style.css +4 -0
@@ 180,6 180,10 @@ input[type="password"] {
width: 14rem;
}
+input[type="checkbox"], input[type="checkbox"] + label {
+ display: inline-block;
+}
+
input.error, textarea.error {
border-color: var(--red);
}
M templates/base.html => templates/base.html +7 -2
@@ 6,8 6,13 @@ SPDX-License-Identifier: CC-BY-SA-4.0
-->
{% macro input(field) %}
- {{ field.label }}
- {{ field(class="error" if field.errors, *varargs, **kwargs) }}
+ {% if field.widget.input_type == "checkbox" %}
+ {{ field(class="error" if field.errors, *varargs, **kwargs) }}
+ {{ field.label }}
+ {% else %}
+ {{ field.label }}
+ {{ field(class="error" if field.errors, *varargs, **kwargs) }}
+ {% endif %}
{% for error in field.errors %}
<small class="error">{{ error }}</small><br>
{% endfor %}