From d79e078e163d92e54086a913b95bf54dc84e731d Mon Sep 17 00:00:00 2001
From: Arno Wunderlich <arno.a.wunderlich@student.jyu.fi>
Date: Fri, 17 Feb 2023 10:19:26 +0000
Subject: [PATCH] fixed bug #23 reset default page to list bid

---
 src/tjts5901/auth.py             |  4 ++--
 src/tjts5901/templates/base.html |  2 +-
 src/tjts5901/views.py            | 13 +------------
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/tjts5901/auth.py b/src/tjts5901/auth.py
index adce70da..83d272cf 100644
--- a/src/tjts5901/auth.py
+++ b/src/tjts5901/auth.py
@@ -180,7 +180,7 @@ def login():
                 # Better check that the user actually clicked on a relative link
                 # or else they could redirect you to a malicious website!
                 if next is None or not next.startswith('/'):
-                    next = url_for('views.index')
+                    next = url_for('views.list_bid')
 
                 return redirect(next)
             else:
@@ -202,7 +202,7 @@ def logout():
     """
     logout_user()
     flash("You have been logged out.")
-    return redirect(url_for('views.index'))
+    return redirect(url_for('auth.login'))
 
 
 @bp.route('/profile', defaults={'email': 'me'})
diff --git a/src/tjts5901/templates/base.html b/src/tjts5901/templates/base.html
index 90620a4f..f6b87e47 100644
--- a/src/tjts5901/templates/base.html
+++ b/src/tjts5901/templates/base.html
@@ -12,7 +12,7 @@
     <link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
 
     <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
-      <a class="navbar-brand" href="{{url_for('views.index')}}">{{config['BRAND']}}</a> 
+      <a class="navbar-brand" href="{{url_for('views.list_bid')}}">{{config['BRAND']}}</a> 
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01"
        aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
diff --git a/src/tjts5901/views.py b/src/tjts5901/views.py
index 5c9807a1..72d2389b 100644
--- a/src/tjts5901/views.py
+++ b/src/tjts5901/views.py
@@ -65,18 +65,6 @@ def get_item_price(item: Item) -> int:
         return item.starting_bid
 
 
-@bp.route("/")
-def index() -> str:
-    """
-    Index page.
-
-    """
-
-    # Render template file. Template file is using Jinja2 syntax, and can be passed an arbitrary number
-    # of arguments to be used in the template. The template file is located in the templates directory.
-    html = render_template("index.html.j2", title="TJTS5901 Example. It was changed by Arno.")
-    return html
-
 @bp.route("/test")
 def test_item_adding():
     """
@@ -155,6 +143,7 @@ def add_item():
     return item
 
 
+@bp.route("/")
 @bp.route("/listBid")
 @login_required
 def list_bid():
-- 
GitLab