diff --git a/main.py b/main.py index 5d19125..dd0d25a 100644 --- a/main.py +++ b/main.py @@ -77,6 +77,13 @@ def fetch_user_details(uid, limit): return userData +def delete_user_details(user_id): + + ancestor = datastore_client.key('UserId', user_id) + query = datastore_client.query(kind='userDetails', ancestor=ancestor) + data = query.fetch() + datastore_client.delete_multi(data) + @app.route('/') @app.route('/index') @@ -185,9 +192,14 @@ def editGame(slug): data=mongoDb.get_single_game(slug) return render_template("editGameDetails.html", data=data) -@app.route('/account') +@app.route('/account', methods=["GET", "POST"]) def account(): + if request.method == "POST": + user_id = request.form["user_id"] + + delete_user_details(user_id) + id_token = request.cookies.get("token") claims = google.oauth2.id_token.verify_firebase_token( @@ -225,6 +237,12 @@ def accountInfo(): data = mongoDb.get_games() return render_template('accountInfo.html', data=data, user_data=user_data) + +@app.route('/deleteUserdata', methods=["DELETE"]) +def deleteExtraAccountInfo(): + + return redirect('/account') + if __name__ == '__main__': # This is used when running locally only. When deploying to Google App # Engine, a webserver process such as Gunicorn will serve the app. This diff --git a/static/custom.css b/static/custom.css index 15b88bf..3c7e517 100644 --- a/static/custom.css +++ b/static/custom.css @@ -2,7 +2,7 @@ @import url('https://fonts.googleapis.com/css2?family=Exo:wght@900&display=swap'); body { - width: 100%; + width: 100vw; height: 100%; background-color: black; max-width: 100%; @@ -203,8 +203,7 @@ p{ .navbar .container-fluid .navbar-header .navbar-brand { color: greenyellow; background-repeat: no-repeat; - padding-left: 20px; - padding-right: 5px; + padding-left: 35px; font-family: 'Exo'; font-size: 40px; transform: skew(-15deg); @@ -231,13 +230,7 @@ p{ } @media screen and (max-width: 770px) { body { - background-color: black; - } - .nav { - display: none; - } - .conentDiv{ - display: none; + width: 770px; } } @media (max-width: 1500px) { diff --git a/static/gamesDetails.css b/static/gamesDetails.css index 781e7e6..20712df 100644 --- a/static/gamesDetails.css +++ b/static/gamesDetails.css @@ -63,6 +63,9 @@ body{ font-weight: bold; margin-top: -10px; } +.badPricing{ + color: red !important; +} #rating{ margin-top: -15px; font-size: 15px; diff --git a/templates/account.html b/templates/account.html index 63621c0..7c758a7 100644 --- a/templates/account.html +++ b/templates/account.html @@ -10,6 +10,12 @@
+ {% if user_data %} +
+
+ +
+ {% endif %} {% if user_data %}

Name:

{{ user_data['name'] }}

diff --git a/templates/base.html b/templates/base.html index 595bdce..289339a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -108,7 +108,7 @@ document.getElementById("edit-gameBtn").style.display='block'; document.getElementById("add-gameBtn").style.display='block'; } else { - console.log("User not authorised to use CRUD") + console.log("User not authorised to use CRUD") } } else { console.log("No user signed in") diff --git a/templates/games.html b/templates/games.html index edf7ec2..218c7d0 100644 --- a/templates/games.html +++ b/templates/games.html @@ -19,7 +19,7 @@

Add Game


-
+

diff --git a/templates/gamesDetails.html b/templates/gamesDetails.html index 6f43353..8729203 100644 --- a/templates/gamesDetails.html +++ b/templates/gamesDetails.html @@ -5,7 +5,7 @@ {% set active_page = "games" %} {% block body %}
- +
{% for game in data %}
@@ -16,8 +16,10 @@

{{ game.slug }}

{{ game.name }}

{% if game.price == "FREE" %}

{{ game.price }}

- {% else %} + {% elif game.price == number %}

£{{ game.price }}

+ {% else %} +

Error, bad pricing

{% endif %}

Rating: {{ game.rating }}/5

{{ game.description }}

diff --git a/templates/index.html b/templates/index.html index ad4fb88..8adcd40 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,80 +1,26 @@ - + Advanced Developmeny Coursework - - - - - - - - - - - - - - -

GameZone

Game Store

- - -
- - - - - - - -