Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/authentication/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from app.authenticator import authenticator
from app.util import login_user, logout_user
from app.util import get_git_branch

from . import authentication_bp

Expand All @@ -21,7 +22,7 @@ def signin():
"""
route: /auth/signin
"""
return render_template('authentication/signin.html')
return render_template('authentication/signin.html', gitv=get_git_branch())

@authentication_bp.route('/signin/<username>/<password>', methods=['GET'])
def authenticate(username, password):
Expand All @@ -36,7 +37,7 @@ def registration():
"""
route: /auth/registration
"""
return render_template('authentication/registration.html')
return render_template('authentication/registration.html', gitv=get_git_branch())

@authentication_bp.route('/registration/<username>/<password>', methods=['GET'])
def register(username, password):
Expand All @@ -50,7 +51,7 @@ def restore_password():
"""
route: /auth/restore-password
"""
return render_template('authentication/restore-password.html')
return render_template('authentication/restore-password.html', gitv=get_git_branch())

@authentication_bp.route('/signout')
def signout():
Expand Down
13 changes: 13 additions & 0 deletions app/authentication/static/registration.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,17 @@ button:hover {
text-align: center;
margin-top: 30px;
color: #fff;
}

#gitv-label {
position: absolute;
top: 10px;
left: 10px;
background-color: burlywood;
color: black;
padding: 5px 20px;
font-size: 10px;
/* font-weight: bold; */
border-radius: 25px;
z-index: 1000;
}
22 changes: 22 additions & 0 deletions app/authentication/static/restore-password.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@200;300;400;500;600;700&display=swap");

* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Open Sans", sans-serif;
}

body {
display: flex;
align-items: center;
Expand Down Expand Up @@ -25,4 +34,17 @@ h1 {
opacity: 0.6;
transform: translateY(0);
}
}

#gitv-label {
position: absolute;
top: 10px;
left: 10px;
background-color: burlywood;
color: black;
padding: 5px 20px;
font-size: 10px;
/* font-weight: bold; */
border-radius: 25px;
z-index: 1000;
}
13 changes: 13 additions & 0 deletions app/authentication/static/signin.css
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,17 @@ button:hover {
text-align: center;
margin-top: 30px;
color: #fff;
}

#gitv-label {
position: absolute;
top: 10px;
left: 10px;
background-color: burlywood;
color: black;
padding: 5px 20px;
font-size: 10px;
/* font-weight: bold; */
border-radius: 25px;
z-index: 1000;
}
3 changes: 3 additions & 0 deletions app/authentication/templates/authentication/registration.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<title>Registration</title>
</head>
<body>
{% if gitv %}
<div id="gitv-label">-b {{ gitv }}</div>
{% endif %}
<div class="wrapper">
<form action="#">
<h2>REGISTRATION</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<title>Restore Password</title>
</head>
<body>
{% if gitv %}
<div id="gitv-label">-b {{ gitv }}</div>
{% endif %}
<h1>Restore Password</h1>
</body>
</html>
3 changes: 3 additions & 0 deletions app/authentication/templates/authentication/signin.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
</head>

<body>
{% if gitv %}
<div id="gitv-label">-b {{ gitv }}</div>
{% endif %}
<div class="wrapper">
<form action="#">
<h2>SIGN IN</h2>
Expand Down
5 changes: 3 additions & 2 deletions app/home/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from flask import render_template

from app.util import login_required
from app.util import get_git_branch

from . import home_bp

Expand All @@ -15,7 +16,7 @@ def home():
Returns:
str: The rendered HTML of the home page.
"""
return render_template('home/home.html')
return render_template('home/home.html', gitv=get_git_branch())

@home_bp.route('/private')
@login_required
Expand All @@ -25,4 +26,4 @@ def home_private():
Returns:
str: The rendered HTML of the home page.
"""
return render_template('home/home-private.html')
return render_template('home/home-private.html', gitv=get_git_branch())
13 changes: 13 additions & 0 deletions app/home/static/home-private.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,17 @@ li {
border-radius: 50px !important;
margin: 0 0 0 10px;
padding: 9px 17px 9px 19px;
}

#gitv-label {
position: absolute;
top: 10px;
left: 10px;
background-color: burlywood;
color: black;
padding: 5px 20px;
font-size: 10px;
/* font-weight: bold; */
border-radius: 25px;
z-index: 1000;
}
13 changes: 13 additions & 0 deletions app/home/static/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,17 @@ li {
border-radius: 50px !important;
margin: 0 0 0 10px;
padding: 9px 17px 9px 19px;
}

#gitv-label {
position: absolute;
top: 10px;
left: 10px;
background-color: burlywood;
color: black;
padding: 5px 20px;
font-size: 10px;
/* font-weight: bold; */
border-radius: 25px;
z-index: 1000;
}
3 changes: 3 additions & 0 deletions app/home/templates/home/home-private.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
</head>

<body>
{% if gitv %}
<div id="gitv-label">-b {{ gitv }}</div>
{% endif %}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<div class="collapse navbar-collapse" id="navbarNav">
Expand Down
3 changes: 3 additions & 0 deletions app/home/templates/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
</head>

<body>
{% if gitv %}
<div id="gitv-label">-b {{ gitv }}</div>
{% endif %}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<div class="collapse navbar-collapse" id="navbarNav">
Expand Down
1 change: 1 addition & 0 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

DEBUG_MODE = True
GIT_BRANCH = True

# Path to the user database
USER_DB = "app/database/dbs/user.db"
Expand Down
9 changes: 9 additions & 0 deletions app/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

from functools import wraps
from flask import redirect, url_for, session
from git import Repo

from app.settings import GIT_BRANCH

def login_required(f):
"""
Expand All @@ -30,3 +33,9 @@ def logout_user():
Log out the user by removing their user ID from the session.
"""
session.clear() # Clear the session to log out the user

def get_git_branch():
"""
return name of current Git branch
"""
return Repo('.').active_branch.name if GIT_BRANCH else None
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
flask
pytest
pytest
GitPython