mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Few fixes
This commit is contained in:
@@ -98,7 +98,7 @@ class Command(BaseCommand):
|
||||
allowed_host = input("What will be the hostname used to access Modoboa? ")
|
||||
if not allowed_host:
|
||||
allowed_host = "localhost"
|
||||
frontend_application = app_model.objects.filter(name="frontend")
|
||||
frontend_application = app_model.objects.filter(name="Modoboa frontend")
|
||||
frontend_path = getattr(settings, "NEW_ADMIN_URL", "new-admin")
|
||||
redirect_uri = f"https://{allowed_host}/{frontend_path}/login/logged"
|
||||
client_id = ""
|
||||
|
||||
@@ -57,9 +57,6 @@ class AuthenticationTestCase(ModoTestCase):
|
||||
user.save()
|
||||
data = {"username": "user@test.com", "password": "toto"}
|
||||
response = self.client.post(reverse("core:login"), data)
|
||||
|
||||
response = self.client.get(response.url)
|
||||
self.assertEqual(response.status_code, 302)
|
||||
url = reverse("core:2fa_verify")
|
||||
self.assertTrue(response.url.endswith(url))
|
||||
|
||||
|
||||
@@ -76,11 +76,13 @@ class LoginView(LoginViewMixin, auth_views.LoginView):
|
||||
template_name = "registration/login.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
announcements = signals.get_announcements.send(
|
||||
sender="login", location="loginpage"
|
||||
)
|
||||
announcements = [announcement[1] for announcement in announcements]
|
||||
return super().get_context_data(announcements=announcements, **kwargs)
|
||||
context.update({"announcements": announcements})
|
||||
return context
|
||||
|
||||
def check_password_hash(self, user, form):
|
||||
condition = user.is_local and param_tools.get_global_parameter(
|
||||
@@ -141,7 +143,7 @@ class LoginView(LoginViewMixin, auth_views.LoginView):
|
||||
"user": escape(form.cleaned_data["username"]),
|
||||
}
|
||||
)
|
||||
return super().form_invalid(form)
|
||||
return self.render_to_response(self.get_context_data(form=form), status=401)
|
||||
|
||||
|
||||
@require_http_methods(["POST"])
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block sub_content %}
|
||||
{% for annoucement in annoucements %}
|
||||
<div>{{ annoucement|safe }}</div>
|
||||
{% for announcement in announcements %}
|
||||
<div>{{ announcement|safe }}</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user