From 9e2ab147fb6a82918e66fa3cb44ab49ef8717103 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 30 Sep 2020 20:31:44 -0700 Subject: [PATCH 1/2] Hide registration form when registration is closed --- bookwyrm/templates/layout.html | 7 +- bookwyrm/templates/login.html | 112 +++++++++++++++++++++---------- bookwyrm/templates/register.html | 49 -------------- bookwyrm/urls.py | 1 - bookwyrm/views.py | 10 --- 5 files changed, 78 insertions(+), 101 deletions(-) delete mode 100644 bookwyrm/templates/register.html diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index 829f781e..3aacb031 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -99,11 +99,8 @@ {% else %} diff --git a/bookwyrm/templates/login.html b/bookwyrm/templates/login.html index d9145d3d..4c61495a 100644 --- a/bookwyrm/templates/login.html +++ b/bookwyrm/templates/login.html @@ -2,46 +2,86 @@ {% block content %}
-
-

About {{ site_settings.name }}

-

- {{ site_settings.instance_description }} -

+
+
+ {% if site_settings.allow_registration %} +

Create an Account

-

- More about this site -

- -

- Create an Account -

-
- -
-

Log in

- -
-
- {% csrf_token %} -
- -
{{ login_form.username }}
-
-
- -
{{ login_form.password }}
-
-
-
- + + {% csrf_token %} +
+ +
+ +
-
- Forgot your password? +
+ +
+ +
-
- +
+ +
+ +
+
+
+
+ +
+
+ + {% else %} +

This instance is closed

+

Contact an administrator to get an invite

+ {% endif %} +
+
+ +
+
+

Log in

+
+ {% csrf_token %} +
+ +
+ {{ login_form.username }} +
+
+
+ +
+ {{ login_form.password }} +
+
+
+
+ +
+ +
+
+
+
+

About {{ site_settings.name }}

+

+ {{ site_settings.instance_description }} +

+ +

+ More about this site +

+ +

+ Create an Account +

+
-
{% endblock %} diff --git a/bookwyrm/templates/register.html b/bookwyrm/templates/register.html deleted file mode 100644 index 10191860..00000000 --- a/bookwyrm/templates/register.html +++ /dev/null @@ -1,49 +0,0 @@ -{% extends 'layout.html' %} -{% block content %} - -
-
-

About {{ site_settings.name }}

-

- {{ site_settings.instance_description }} -

- -

- More about this site -

- -

- Log In -

-
- -
-

Create an Account

- -
-
- {% csrf_token %} -
- -
{{ register_form.username }}
-
-
- -
{{ register_form.email }}
-
-
- -
{{ register_form.password }}
-
-
-
- -
-
-
-
-
- -
-{% endblock %} - diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 626c1bb0..d35ed377 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -38,7 +38,6 @@ urlpatterns = [ # ui views re_path(r'^login/?$', views.login_page), - re_path(r'^register/?$', views.register_page), re_path(r'^about/?$', views.about_page), re_path(r'^invite/?$', views.manage_invites), re_path(r'^invite/(?P[A-Za-z0-9]+)/?$', views.invite_page), diff --git a/bookwyrm/views.py b/bookwyrm/views.py index e619856d..129274fc 100644 --- a/bookwyrm/views.py +++ b/bookwyrm/views.py @@ -193,16 +193,6 @@ def login_page(request): return TemplateResponse(request, 'login.html', data) -def register_page(request): - ''' authentication ''' - # send user to the login page - data = { - 'site_settings': models.SiteSettings.get(), - 'register_form': forms.RegisterForm(), - } - return TemplateResponse(request, 'register.html', data) - - def about_page(request): ''' more information about the instance ''' data = { From 2fd192d6cced9a4d656e147a5e7c1a274d60bcd3 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 30 Sep 2020 20:47:26 -0700 Subject: [PATCH 2/2] Updates ui and redirects for invites --- bookwyrm/templates/invite.html | 44 +++++++------------ bookwyrm/templates/login.html | 39 +--------------- bookwyrm/templates/snippets/about.html | 8 ++++ .../templates/snippets/register_form.html | 24 ++++++++++ bookwyrm/views.py | 5 +++ 5 files changed, 56 insertions(+), 64 deletions(-) create mode 100644 bookwyrm/templates/snippets/about.html create mode 100644 bookwyrm/templates/snippets/register_form.html 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 - -

-
- -