Fix the login page and the inventory page's login link

This commit is contained in:
ponas committed 2026-10-23 02:58:10 +02:00
1 parent 60108b9d89
commit edacf81401
2 files changed
+9 -2

No files matched your search

+6 -1
View File
@@ -18,7 +18,12 @@ urlpatterns = [
path("inventory/add/", spa_index),
path("report", spa_index, name="report"),
path("report/", spa_index),
path("accounts/login/", LoginView.as_view(), name="django.contrib.auth.views.login"),
# bbs has no login template of its own; the admin's works for any user
path(
"accounts/login/",
LoginView.as_view(template_name="admin/login.html", extra_context={"site_header": "BBS"}),
name="django.contrib.auth.views.login",
),
path(
"accounts/logout/",
LogoutView.as_view(),
@@ -7,6 +7,8 @@ import { GQLError } from "../../components/GQLError";
import { useToast } from "../../hooks/useToast";
import { CreateInventoryTransactionDocument, InventoryProductsDocument } from "../../types";
const LOGIN_URL = `${import.meta.env.VITE_API_URL}/accounts/login/?next=/inventory/add`;
const InventoryAdd = () => {
const navigate = useNavigate();
const { showToast } = useToast();
@@ -55,7 +57,7 @@ const InventoryAdd = () => {
<div>
<h2>Registrer varetransaksjon</h2>
<p>
Du må være innlogget for å registrere varer. <a href="/accounts/login/">Logg inn</a>.
Du må være innlogget for å registrere varer. <a href={LOGIN_URL}>Logg inn</a>.
</p>
<form className={styles.form} onSubmit={onSubmit}>
<label>