Fix login endpoint redirect
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Madis Mägi 2024-07-29 06:42:40 +03:00
parent 51c044bd94
commit 37544700d5
3 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import boto3
import pymongo
import urllib
from datetime import datetime, date, timedelta
from botocore.exceptions import ClientError
from bson.objectid import ObjectId
@ -30,6 +31,7 @@ def view_inventory_view(item_id):
if not item["inventory"].get("public"):
return do_login()
template = "inventory_view_public.html"
redirect_url = urllib.parse.quote_plus(request.full_path)
else:
can_audit = "k-space:janitors" in user["groups"]
can_edit = check_edit_permission(item_id)

View File

@ -208,7 +208,7 @@ def name_check(form, field):
@app.route("/login")
@login_required
def login_dummy():
return redirect("/m/inventory")
return redirect(request.args.get("redirect_url", "/m/inventory"))
@app.route("/")
def index():

View File

@ -1,7 +1,7 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<h6>Please <a href="/login">log in</a> to see more details</h6>
<h6>Please <a href="/login?redirect_url={{ redirect_url }}">log in</a> to see more details</h6>
<p>Inventory item.</p>
<table>