diff --git a/templates/landingpage.html b/templates/landingpage.html index f11aaa4a558bcd6e96e8fd7ffe4274b34a5379e9..e2469cce4169f31c561ab0983f9a6b7aff70ccf7 100644 --- a/templates/landingpage.html +++ b/templates/landingpage.html @@ -14,6 +14,9 @@ <li class="nav-item"> <a class="nav-link" href="/coworking">Manage locations</a> </li> + <li class="nav-item"> + <a class="nav-link" href="/login">Login</a> + </li> </ul> </div> </nav> diff --git a/templates/login.html b/templates/login.html index e797e0efbcb69b1288c89e40f8b614e93aa3a008..714500970704d5cf0a6418864b2e8724fa3e904e 100644 --- a/templates/login.html +++ b/templates/login.html @@ -7,14 +7,14 @@ <div class="container-fluid"> <ul class="navbar-nav"> <li class="nav-item"> - <a class="nav-link" href="landingpage.html">Back</a> + <a class="nav-link" href="/home">Back</a> </li> </ul> </div> </nav> <header class="masthead bg-dark text-white text-center"> <div class="container-fluid"> - <img id="logo" src="Media/logo.png"/> + <img id="logo" src="static/Media/logo.png"/> <h1 id="header">Tramshed Tech</h1> </div> </header> @@ -25,28 +25,28 @@ <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Sora:wght@800&display=swap" rel="stylesheet"> - <link rel="stylesheet" href="CSS/loginstyle.css"> - <script src="JS/login.js"></script> + <link rel="stylesheet" href="static/CSS/loginstyle.css"> + <script src="static/JS/login.js"></script> <title>Login</title> <div id="card" class="card text-dark w-25 text-center"> <div class="card-body text-center"> - <form action="/login" method="post"> + <form action="/signin" method="post"> <!-- Email input --> <div class="form-outline mb-4"> <input type="email" name="recordEmail" id="recordEmail" class="form-control" /> - <label class="form-label" for="form2Example1">Email address</label> + <label class="form-label">Email address</label> </div> <!-- Password input --> <div class="form-outline mb-4"> <input type="password" name="recordPassword" id="recordPassword" class="form-control" /> - <label class="form-label" for="form2Example2">Password</label> + <label class="form-label">Password</label> </div> <!-- Submit button --> - <button type="submit" class="btn btn-light" id="loginButton"> + <button type="submit" class="btn btn-light" id="loginButton" href="/locations"> <span class="spinner-grow spinner-grow-sm"></span> Sign in </button> diff --git a/testloginserver.py b/testloginserver.py index 997396bdf5a8ad834a94995e35900551ffa83738..1cb3a9abdc0a10574357b2d40b3b6d9aabe675b3 100644 --- a/testloginserver.py +++ b/testloginserver.py @@ -1,6 +1,6 @@ import os import sqlite3 -from flask import Flask, request, render_template +from flask import Flask, request, render_template, send_from_directory app = Flask(__name__) @@ -12,13 +12,17 @@ def load(): @app.route("/locations", methods=["GET"]) def loadlocations(): - return render_template('locations.html') + return send_from_directory('static', 'locations.html') @app.route("/coworking", methods=["GET"]) def loadcoworking(): return render_template('manage_coworking_spaces.html') -@app.route("/login", methods=['GET', 'POST']) +@app.route("/login", methods=["GET"]) +def loadlogin(): + return render_template('login.html') + +@app.route("/signin", methods=['GET', 'POST']) def login(): error = None if (request.method =='POST'): @@ -40,15 +44,7 @@ def login(): conn.close() finally: conn.close() - return render_template('landingpage.html') - -def select(): - conn = sqlite3.connect("login.db") - cur = conn.cursor() - cur.execute("SELECT Email, Password FROM login") - users = cur.fetchall() - conn.close() - return users + return render_template('locations.html') if __name__ == "__main__": app.run(debug=True) \ No newline at end of file