Fix the login page and the inventory page's login link
This commit is contained in:
2 files changed
+9
-2
No files matched your search
+6
-1
@@ -18,7 +18,12 @@ urlpatterns = [
|
|||||||
path("inventory/add/", spa_index),
|
path("inventory/add/", spa_index),
|
||||||
path("report", spa_index, name="report"),
|
path("report", spa_index, name="report"),
|
||||||
path("report/", spa_index),
|
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(
|
path(
|
||||||
"accounts/logout/",
|
"accounts/logout/",
|
||||||
LogoutView.as_view(),
|
LogoutView.as_view(),
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { GQLError } from "../../components/GQLError";
|
|||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../hooks/useToast";
|
||||||
import { CreateInventoryTransactionDocument, InventoryProductsDocument } from "../../types";
|
import { CreateInventoryTransactionDocument, InventoryProductsDocument } from "../../types";
|
||||||
|
|
||||||
|
const LOGIN_URL = `${import.meta.env.VITE_API_URL}/accounts/login/?next=/inventory/add`;
|
||||||
|
|
||||||
const InventoryAdd = () => {
|
const InventoryAdd = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { showToast } = useToast();
|
const { showToast } = useToast();
|
||||||
@@ -55,7 +57,7 @@ const InventoryAdd = () => {
|
|||||||
<div>
|
<div>
|
||||||
<h2>Registrer varetransaksjon</h2>
|
<h2>Registrer varetransaksjon</h2>
|
||||||
<p>
|
<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>
|
</p>
|
||||||
<form className={styles.form} onSubmit={onSubmit}>
|
<form className={styles.form} onSubmit={onSubmit}>
|
||||||
<label>
|
<label>
|
||||||
|
|||||||
Reference in new issue
Block a user