Skip to content
Snippets Groups Projects
Commit db120bd5 authored by Rhiannon Austin's avatar Rhiannon Austin
Browse files

Login Working

parent f3fe5bf7
No related branches found
No related tags found
No related merge requests found
File added
from flask import Flask, request, render_template from flask import Flask, request, render_template, redirect
import database import database
app = Flask(__name__) app = Flask(__name__)
...@@ -9,14 +9,14 @@ def home(): ...@@ -9,14 +9,14 @@ def home():
workspaces = database.get_workspaces() workspaces = database.get_workspaces()
return render_template("home.html", workspaces = workspaces) return render_template("home.html", workspaces = workspaces)
@app.route('/login', methods = ["GET"]) @app.route('/login', methods = ["GET", "POST"])
def login(): def login():
username = request.form.get('username') username = request.form.get('username')
if username == "admin": if username == "admin":
return redirect("/") return redirect("/")
else: else:
message = "Wrong Username" message = "Wrong Username"
return redirect("/login.html") return render_template("login.html")
if __name__ == "__main__": if __name__ == "__main__":
app.run(debug = True) app.run(debug = True)
File added
...@@ -13,24 +13,18 @@ ...@@ -13,24 +13,18 @@
<title>{% block title %}{% endblock %} - Tramshed Workspaces</title> <title>{% block title %}{% endblock %} - Tramshed Workspaces</title>
</head> </head>
<form class='myForm' method="POST" action="">
<p>Enter Username: </p>
<br>
<input type = "text" name = "username" placeholder="Username.." ><br>
<button type = "submit" id='mySubmit'> Submit </button>
</form>
<!-- <div class="parallax"> <!-- <div class="parallax">
<body class="body"> <body class="body">
<!--<img src="static/Tramshed_Logo.jpg" alt="Logo" height="50" width="100">--> <!--<img src="static/Tramshed_Logo.jpg" alt="Logo" height="50" width="100">-->
<!-- navigation --> --> <!-- navigation -->
<nav>
<ul> <form class='myForm' method="POST" action="">
<li><a href="#home">Home</a></li> <p>Enter Username: </p>
<li><a href="#Map">Map</a></li> <br>
<li><a href="#contactUs">Contact Us</a></li> <input type = "text" name = "username" placeholder="Username.." ><br>
<li style="float:right"><a class="active" href="#about">About</a></li> <button type = "submit" id='mySubmit'> Submit </button>
</ul> </form>
</nav>
<!--{% block mainBlock %}{% endblock %}--> <!--{% block mainBlock %}{% endblock %}-->
</body> </body>
</html> </html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment