+
{% trans "or" %}
-
diff --git a/hypha/apply/users/templates/users/register.html b/hypha/apply/users/templates/users/register.html
deleted file mode 100644
index 1b9b08de0b..0000000000
--- a/hypha/apply/users/templates/users/register.html
+++ /dev/null
@@ -1,45 +0,0 @@
-{% extends "base-apply.html" %}
-{% load i18n wagtailcore_tags %}
-
-{% block title %}{% trans "Register" %}{% endblock %}
-{% block body_class %}bg-white{% endblock %}
-
-{% block content %}
-
-
-
- {% if settings.users.AuthSettings.register_extra_text %}
-
-
- {{ settings.users.AuthSettings.register_extra_text|richtext}}
-
-
- {% endif %}
-
-{% endblock %}
diff --git a/hypha/apply/users/tests/test_registration.py b/hypha/apply/users/tests/test_registration.py
deleted file mode 100644
index 510a2708eb..0000000000
--- a/hypha/apply/users/tests/test_registration.py
+++ /dev/null
@@ -1,71 +0,0 @@
-from django.conf import settings
-from django.core import mail
-from django.test import TestCase, override_settings
-from django.urls import reverse
-
-from hypha.apply.funds.tests.factories import FundTypeFactory
-from hypha.apply.utils.testing import make_request
-
-
-class TestRegistration(TestCase):
- @override_settings(ENABLE_PUBLIC_SIGNUP=False)
- def test_registration_enabled_has_no_link(self):
- response = self.client.get("/", follow=True)
- self.assertNotContains(response, reverse("users:register"))
-
- @override_settings(ENABLE_PUBLIC_SIGNUP=True)
- def test_registration_enabled_has_link(self):
- response = self.client.get("/", follow=True)
- self.assertContains(response, reverse("users:register"))
-
- @override_settings(ENABLE_PUBLIC_SIGNUP=True)
- def test_registration(self):
- response = self.client.post(
- reverse("users:register"),
- data={
- "email": "test@test.com",
- "first_name": "Not used - see full_name",
- "last_name": "Not used - see full_name",
- },
- secure=True,
- )
- assert len(mail.outbox) == 1
- assert "Activate your account on the" in mail.outbox[0].body
-
- assert response.status_code == 302
- assert reverse("users:register-success") in response.url
-
- @override_settings(ENABLE_PUBLIC_SIGNUP=True)
- def test_duplicate_registration_fails(self):
- response = self.client.post(
- reverse("users:register"),
- data={
- "email": "test@test.com",
- "first_name": "Not used - see full_name",
- "last_name": "Not used - see full_name",
- },
- secure=True,
- )
- mail.outbox.clear()
-
- response = self.client.post(
- reverse("users:register"),
- data={
- "email": "test@test.com",
- "first_name": "Not used - see full_name",
- "last_name": "Not used - see full_name",
- },
- secure=True,
- )
-
- assert len(mail.outbox) == 0
- self.assertContains(response, "A user with that email already exists")
-
- @override_settings(FORCE_LOGIN_FOR_APPLICATION=True, ENABLE_PUBLIC_SIGNUP=False)
- def test_force_login(self):
- fund = FundTypeFactory()
- response = fund.serve(
- make_request(None, {}, method="get", site=fund.get_site())
- )
- assert response.status_code == 302
- assert response.url == reverse(settings.LOGIN_URL) + "?next=/"
diff --git a/hypha/apply/users/urls.py b/hypha/apply/users/urls.py
index 3759fb8202..32afa399a6 100644
--- a/hypha/apply/users/urls.py
+++ b/hypha/apply/users/urls.py
@@ -17,8 +17,6 @@
PasswordlessSignupView,
PasswordResetConfirmView,
PasswordResetView,
- RegisterView,
- RegistrationSuccessView,
TWOFAAdminDisableView,
TWOFADisableView,
TWOFASetupView,
@@ -39,10 +37,6 @@
),
path("login/", LoginView.as_view(), name="login"),
path("logout/", auth_views.LogoutView.as_view(next_page="/"), name="logout"),
- path("register/", RegisterView.as_view(), name="register"),
- path(
- "register-success/", RegistrationSuccessView.as_view(), name="register-success"
- ),
]
account_urls = [
diff --git a/hypha/apply/users/views.py b/hypha/apply/users/views.py
index 041fcfc99d..430643ced2 100644
--- a/hypha/apply/users/views.py
+++ b/hypha/apply/users/views.py
@@ -18,7 +18,7 @@
from django.core.exceptions import PermissionDenied
from django.core.signing import TimestampSigner, dumps, loads
from django.http import HttpResponse, HttpResponseRedirect
-from django.shortcuts import Http404, get_object_or_404, redirect, render, resolve_url
+from django.shortcuts import Http404, get_object_or_404, redirect, render
from django.template.loader import render_to_string
from django.template.response import TemplateResponse
from django.urls import reverse, reverse_lazy
@@ -30,7 +30,7 @@
from django.views.decorators.cache import never_cache
from django.views.decorators.debug import sensitive_post_parameters
from django.views.generic import UpdateView
-from django.views.generic.base import TemplateView, View
+from django.views.generic.base import TemplateView
from django.views.generic.edit import FormView
from django_htmx.http import HttpResponseClientRedirect
from django_otp import devices_for_user
@@ -56,7 +56,6 @@
from .forms import (
BecomeUserForm,
CustomAuthenticationForm,
- CustomUserCreationForm,
Disable2FAConfirmationForm,
PasswordlessAuthForm,
ProfileForm,
@@ -74,65 +73,6 @@
User = get_user_model()
-@method_decorator(
- ratelimit(key="ip", rate=settings.DEFAULT_RATE_LIMIT, method="POST"),
- name="dispatch",
-)
-class RegisterView(View):
- redirect_field_name = "next"
- form = CustomUserCreationForm
-
- def get(self, request):
- # We keep /register in the urls in order to test (where we turn on/off
- # the setting per test), but when disabled, we want to pretend it doesn't
- # exist va 404
- if not settings.ENABLE_PUBLIC_SIGNUP:
- raise Http404
-
- if request.user.is_authenticated:
- return redirect(settings.LOGIN_REDIRECT_URL)
-
- ctx = {
- "form": self.form(register_view=True),
- "redirect_url": get_redirect_url(request, self.redirect_field_name),
- }
- return render(request, "users/register.html", ctx)
-
- def post(self, request):
- # See comment in get() above about doing this here rather than in urls
- if not settings.ENABLE_PUBLIC_SIGNUP:
- raise Http404
-
- form = self.form(register_view=True, data=request.POST)
- context = {}
- if form.is_valid():
- # If using wagtail password management
- if "password1" in form.cleaned_data:
- context["password"] = form.cleaned_data["password1"]
-
- site = Site.find_for_request(self.request)
- user, created = User.objects.get_or_create_and_notify(
- email=form.cleaned_data["email"],
- site=site,
- redirect_url=get_redirect_url(request, self.redirect_field_name),
- defaults={
- "full_name": form.cleaned_data["full_name"],
- },
- **context,
- )
- if created:
- params = {"name": user.full_name, "email": user.email}
- # redirect to success page with params as query params
- return HttpResponseRedirect(
- resolve_url("users:register-success") + "?" + urlencode(params)
- )
- return render(request, "users/register.html", {"form": form})
-
-
-class RegistrationSuccessView(TemplateView):
- template_name = "users/register-success.html"
-
-
@method_decorator(
ratelimit(key="ip", rate=settings.DEFAULT_RATE_LIMIT, method="POST"),
name="dispatch",
diff --git a/hypha/static_src/sass/components/_link.scss b/hypha/static_src/sass/components/_link.scss
index 9624fab830..591eb11242 100644
--- a/hypha/static_src/sass/components/_link.scss
+++ b/hypha/static_src/sass/components/_link.scss
@@ -9,9 +9,24 @@
@include button($color--light-blue, $color--dark-blue);
display: inline-block;
+ // The custom width of 465px allow the buttons to scale with the input field
+ $input-box-max-width: 465px;
+
&--narrow {
@include button--narrow;
}
+
+ &--login {
+ /* stylelint-disable-next-line media-query-no-invalid */
+ @media (min-width: $input-box-max-width) {
+ width: 20rem;
+ }
+ }
+
+ /* stylelint-disable-next-line media-query-no-invalid */
+ @media (max-width: $input-box-max-width) {
+ width: 100%;
+ }
}
&--underlined {
diff --git a/hypha/templates/base-apply.html b/hypha/templates/base-apply.html
index 89c4cc7899..0c393448e3 100644
--- a/hypha/templates/base-apply.html
+++ b/hypha/templates/base-apply.html
@@ -48,12 +48,9 @@
{% heroicon_outline "bars-3" size=32 stroke_width=2 class="inline" aria_hidden="true" %}
{% else %}
- {% if request.path != '/auth/' %}
+ {% if request.path != '/auth/' and request.path != '/login/' %}
{% include "includes/login_button.html" %}
{% endif %}
- {% if ENABLE_PUBLIC_SIGNUP and request.path == '/auth/' %}
- {% include "includes/register_button.html" %}
- {% endif %}
{% endif %}
@@ -121,7 +118,7 @@