Skip to content

Commit

Permalink
feat: redirect /home to /welcome when users are connected
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Oct 6, 2023
1 parent f296c6a commit b7ec612
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions web/flaskr/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ def index():

@bp.route("/home")
def home():
if has_user_session():
return redirect(url_for("routes.welcome"))
is_rie = any(
[
IPAddress(request.remote_addr) in IPNetwork(network_ip)
Expand Down
7 changes: 5 additions & 2 deletions web/tests/test_default.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from flask import url_for


def test_root__anonymous_user(client_app):
response = client_app.get("/", status=302)

Expand Down Expand Up @@ -32,10 +35,10 @@ def test_home__authenticated_user(client_app, mocker, authenticated_user):
mocker.patch("flaskr.routes.get_meetings_stats", return_value=STATS)

response = client_app.get(
"/home", extra_environ={"REMOTE_ADDR": "127.0.0.1"}, status=200
"/home", extra_environ={"REMOTE_ADDR": "127.0.0.1"}, status=302
)

response.mustcontain("<!-- test page home -->")
assert response.location == url_for("routes.welcome")


def test_change_language(client_app):
Expand Down

0 comments on commit b7ec612

Please sign in to comment.