misc: change / to redirect to portal (#82924)
gitea/lingo/pipeline/head This commit looks good Details

This commit is contained in:
Frédéric Péters 2023-10-28 13:38:35 +02:00
parent 27a4cb79c8
commit 8bda551cb1
3 changed files with 8 additions and 40 deletions

View File

@ -1,32 +0,0 @@
{% load static gadjo i18n %}<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Lingo - {% trans "Payments" context 'lingo title' %}</title>
</head>
<body>
<div id="title"><h1>{% trans "Payments" context 'lingo title' %}</h1></div>
<div id="content">
{% block messages %}
{% if messages %}
<div id="messages">
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endblock %}
{% block lingo-content %}
{% endblock %}
</div>
<div id="footer">
{% block footer %}
<span style="display: none">{% now "Y-m-d H:i:s" %}</span> {# generation time #}
{% endblock %}
</div>
</body>
</html>

View File

@ -20,7 +20,6 @@ from django.contrib.auth import views as auth_views
from django.http import HttpResponseRedirect
from django.shortcuts import resolve_url
from django.utils.http import quote
from django.views.generic import TemplateView
if 'mellon' in settings.INSTALLED_APPS:
from mellon.utils import get_idps # pylint: disable=import-error
@ -55,8 +54,6 @@ def logout(request, next_page=None):
return HttpResponseRedirect(next_page)
class HomepageView(TemplateView):
template_name = 'lingo/homepage.html'
homepage = HomepageView.as_view()
def homepage(request):
template_vars = getattr(settings, 'TEMPLATE_VARS', None) or {}
return HttpResponseRedirect(template_vars.get('portal_user_url') or '/manage/')

View File

@ -3,5 +3,8 @@ import pytest
pytestmark = pytest.mark.django_db
def test_homepage(app):
assert app.get('/', status=200)
def test_homepage(app, settings):
assert app.get('/', status=302).location == '/manage/'
settings.TEMPLATE_VARS['portal_user_url'] = 'https://example.net/'
assert app.get('/', status=302).location == 'https://example.net/'