From 49059e1dce6f747a6eae9c0780e83c148846eadb Mon Sep 17 00:00:00 2001 From: Deimos Date: Fri, 23 Nov 2018 16:56:55 -0700 Subject: [PATCH] Generate invite links instead of codes This doesn't really change anything functionally, but it gives users specific links that they can send out that will pre-fill the invite code on the registration page, instead of requiring them to copy-paste it or type it in themselves. --- tildes/scss/modules/_input.scss | 3 ++- tildes/tildes/templates/intercooler/invite_code.jinja2 | 8 ++++---- tildes/tildes/templates/invite.jinja2 | 8 ++++---- tildes/tildes/templates/register.jinja2 | 2 +- tildes/tildes/views/register.py | 5 +++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/tildes/scss/modules/_input.scss b/tildes/scss/modules/_input.scss index d115d8f..190028f 100644 --- a/tildes/scss/modules/_input.scss +++ b/tildes/scss/modules/_input.scss @@ -2,5 +2,6 @@ // SPDX-License-Identifier: AGPL-3.0-or-later .input-invite-code { - margin-bottom: 0.4rem; + font-size: 0.6rem; + margin-top: 0.4rem; } diff --git a/tildes/tildes/templates/intercooler/invite_code.jinja2 b/tildes/tildes/templates/intercooler/invite_code.jinja2 index d27a1d4..71c5d06 100644 --- a/tildes/tildes/templates/intercooler/invite_code.jinja2 +++ b/tildes/tildes/templates/intercooler/invite_code.jinja2 @@ -4,7 +4,7 @@
{% if num_remaining > 0 %} {% else %} -

You don't currently have any invite codes available.

+

You aren't able to generate more invite links right now.

{% endif %} -

You have the following invite codes active that have not been used yet:

+

You have the following invite links active that have not been used yet:

- + diff --git a/tildes/tildes/templates/invite.jinja2 b/tildes/tildes/templates/invite.jinja2 index b04db35..619cc14 100644 --- a/tildes/tildes/templates/invite.jinja2 +++ b/tildes/tildes/templates/invite.jinja2 @@ -23,7 +23,7 @@
{% if request.user.invite_codes_remaining > 0 %} {% else %} -

You don't currently have any invite codes available.

+

You aren't able to generate more invite links right now.

{% endif %} {% if codes %} -

You have the following invite codes active that have not been used yet:

+

You have the following invite links active that have not been used yet:

{% for code in codes %} - + {% endfor %} {% else %} diff --git a/tildes/tildes/templates/register.jinja2 b/tildes/tildes/templates/register.jinja2 index 2f45673..ee21de5 100644 --- a/tildes/tildes/templates/register.jinja2 +++ b/tildes/tildes/templates/register.jinja2 @@ -19,7 +19,7 @@
- +
diff --git a/tildes/tildes/views/register.py b/tildes/tildes/views/register.py index d4e1225..8ad6b27 100644 --- a/tildes/tildes/views/register.py +++ b/tildes/tildes/views/register.py @@ -25,11 +25,12 @@ from tildes.views.decorators import not_logged_in, rate_limit_view @view_config( route_name="register", renderer="register.jinja2", permission=NO_PERMISSION_REQUIRED ) +@use_kwargs({"code": String(missing="")}) @not_logged_in -def get_register(request: Request) -> dict: +def get_register(request: Request, code: str) -> dict: """Display the registration form.""" # pylint: disable=unused-argument - return {} + return {"code": code} def user_schema_check_breaches(request: Request) -> UserSchema: