Skip to content
Snippets Groups Projects
Commit 822e27fc authored by Beaumont Mogridge's avatar Beaumont Mogridge :gorilla:
Browse files

Merge branch '2-as-a-user-i-want-to-be-authorized-if-i-am-a-member' into 'development'

Pulled from development/pushed test server code

See merge request !42
parents 9c7255d5 a3092818
No related branches found
No related tags found
1 merge request!42Pulled from development/pushed test server code
...@@ -22,4 +22,8 @@ body{ ...@@ -22,4 +22,8 @@ body{
font-family: 'Sora', sans-serif; font-family: 'Sora', sans-serif;
background-color: #212529; background-color: #212529;
color: white; color: white;
<<<<<<< HEAD
} }
=======
}
>>>>>>> 9c7255d510762a8f16afeba2657cad4a0f8b8239
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <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 href="https://fonts.googleapis.com/css2?family=Sora:wght@800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="landingstyle.css"> <link rel="stylesheet" href="CSS/landingstyle.css">
<title>Tramshed Tech</title> <title>Tramshed Tech</title>
<img id="tramshed" src="Media/tramshed.jpg"> <img id="tramshed" src="Media/tramshed.jpg">
<div class="bg-dark p-3"> <div class="bg-dark p-3">
......
...@@ -25,13 +25,21 @@ ...@@ -25,13 +25,21 @@
<form> <form>
<!-- Email input --> <!-- Email input -->
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<<<<<<< HEAD
<input type="email" id="recordEmail" class="form-control" />
=======
<input type="email" id="form2Example1" class="form-control" /> <input type="email" id="form2Example1" class="form-control" />
>>>>>>> 9c7255d510762a8f16afeba2657cad4a0f8b8239
<label class="form-label" for="form2Example1">Email address</label> <label class="form-label" for="form2Example1">Email address</label>
</div> </div>
<!-- Password input --> <!-- Password input -->
<div class="form-outline mb-4"> <div class="form-outline mb-4">
<<<<<<< HEAD
<input type="password" id="recordPassword" class="form-control" />
=======
<input type="password" id="form2Example2" class="form-control" /> <input type="password" id="form2Example2" class="form-control" />
>>>>>>> 9c7255d510762a8f16afeba2657cad4a0f8b8239
<label class="form-label" for="form2Example2">Password</label> <label class="form-label" for="form2Example2">Password</label>
</div> </div>
...@@ -60,4 +68,8 @@ ...@@ -60,4 +68,8 @@
<p>Not a member? <a href="#!">Register</a></p> <p>Not a member? <a href="#!">Register</a></p>
</form> </form>
</body> </body>
<<<<<<< HEAD
</html> </html>
=======
</html>
>>>>>>> 9c7255d510762a8f16afeba2657cad4a0f8b8239
import os
import sqlite3
from flask import Flask, redirect, request, render_template, jsonify
app = Flask(__name__)
DATABASE = "login.db"
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
@app.route("/SearchRecord", methods=['POST'])
def searchRecord():
if request.method =='POST':
try:
recordEmail = request.form.get('recordEmail', default="Error")
conn = sqlite3.connect(DATABASE)
cur = conn.cursor()
cur.execute("SELECT * FROM login WHERE Email=?;", [recordEmail])
recordData = cur.fetchall()
except:
print(f"Error: {recordData}")
conn.close()
finally:
conn.close()
print(f"{str(recordData)} Record found.")
return str(recordData)
@app.route("/AddRecord", methods=['POST'])
def addRecord():
if (request.method == 'POST'):
recordEmail = request.form['recordEmail']
recordPassword = request.form['recordPassword']
conn = sqlite3.connect(DATABASE)
cur = conn.cursor()
cur.execute("INSERT INTO login ('Email', 'Password')\
VALUES (?,?)", (recordEmail, recordPassword))
conn.commit()
conn.close()
infoMessage = (f'{recordData} Record added.')
print(infoMessage)
return (infoMessage)
if __name__ == "__main__":
app.run(debug=True)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment