diff --git a/bookwyrm/templates/invite.html b/bookwyrm/templates/invite.html index 1147673d..939281d8 100644 --- a/bookwyrm/templates/invite.html +++ b/bookwyrm/templates/invite.html @@ -1,33 +1,23 @@ {% extends 'layout.html' %} {% block content %} -
-

About {{ site_settings.name }}

-

- {{ site_settings.instance_description }} -

- -

- - More about this site - -

-
- -
-

Create an Account

-

- With a BookWyrm account, you can track and share your reading activity with - friends here and on any other federated server, like Mastodon and PixelFed. -

- -
-
- {% csrf_token %} - {{ register_form.as_p }} - - -
+
+
+ +
+
+
+ {% include 'snippets/about.html' with site_settings=site_settings %} +
+ {% endblock %} diff --git a/bookwyrm/templates/login.html b/bookwyrm/templates/login.html index 4c61495a..00dcd431 100644 --- a/bookwyrm/templates/login.html +++ b/bookwyrm/templates/login.html @@ -6,32 +6,8 @@
{% if site_settings.allow_registration %}

Create an Account

-
- {% csrf_token %} -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- -
-
+ {% include 'snippets/register_form.html' %}
{% else %}

This instance is closed

@@ -68,18 +44,7 @@
-

About {{ site_settings.name }}

-

- {{ site_settings.instance_description }} -

- -

- More about this site -

- -

- Create an Account -

+ {% include 'snippets/about.html' with site_settings=site_settings %}
diff --git a/bookwyrm/templates/snippets/about.html b/bookwyrm/templates/snippets/about.html new file mode 100644 index 00000000..cbd25678 --- /dev/null +++ b/bookwyrm/templates/snippets/about.html @@ -0,0 +1,8 @@ +

About {{ site_settings.name }}

+

+ {{ site_settings.instance_description }} +

+ +

+ More about this site +

diff --git a/bookwyrm/templates/snippets/register_form.html b/bookwyrm/templates/snippets/register_form.html new file mode 100644 index 00000000..dfde08ab --- /dev/null +++ b/bookwyrm/templates/snippets/register_form.html @@ -0,0 +1,24 @@ +{% csrf_token %} +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
diff --git a/bookwyrm/views.py b/bookwyrm/views.py index 129274fc..9c0513d1 100644 --- a/bookwyrm/views.py +++ b/bookwyrm/views.py @@ -6,6 +6,7 @@ from django.db.models import Avg, Count, Q from django.http import HttpResponseBadRequest, HttpResponseNotFound,\ JsonResponse from django.core.exceptions import PermissionDenied +from django.shortcuts import redirect from django.template.response import TemplateResponse from django.views.decorators.csrf import csrf_exempt @@ -184,6 +185,8 @@ def import_status(request, job_id): def login_page(request): ''' authentication ''' + if request.user.is_authenticated: + return redirect('/') # send user to the login page data = { 'site_settings': models.SiteSettings.get(), @@ -203,6 +206,8 @@ def about_page(request): def invite_page(request, code): ''' endpoint for sending invites ''' + if request.user.is_authenticated: + return redirect('/') try: invite = models.SiteInvite.objects.get(code=code) if not invite.valid():