Skip to content

Commit

Permalink
made changes to app personality
Browse files Browse the repository at this point in the history
  • Loading branch information
Mandawi committed Apr 16, 2020
1 parent 8846816 commit 7942122
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
9 changes: 7 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ def login():
APP.logger.info("Decrypting password")
if sha256_crypt.verify(password, passdata_block):
session["user_id"] = curr_user.my_id
session["user_name"] = curr_user.username
session["log"] = True
APP.logger.info("Successfully logged in")
return redirect(url_for("closet"))
Expand Down Expand Up @@ -260,7 +261,9 @@ def closet(): # LOGIN REQUIRED!
"SELECT closet FROM users_closets WHERE id = %s;", (session["user_id"]),
).fetchone()
user_closet = pickle.loads(str.encode(closet_pickled[0]))
return render_template("my_closet.html", closet=user_closet)
return render_template(
"my_closet.html", closet=user_closet, user=session["user_name"]
)


def get_temp(zipcode):
Expand Down Expand Up @@ -313,7 +316,9 @@ def closet_modify():
(pickle.dumps(user_closet, 0), session["user_id"]),
)
APP.logger.info("Successfully modified closet for user %s", (session["user_id"]))
return render_template("my_closet.html", closet=user_closet)
return render_template(
"my_closet.html", closet=user_closet, user=session["user_name"]
)


@APP.route("/try", methods=["GET", "POST"]) # LOGIN REQUIRED!
Expand Down
6 changes: 3 additions & 3 deletions templates/my_closet.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

{% block page_content %}
<div class="container">
<h1> Welcome to your outdoors closet! </h1>
<h3> Welcome to your outdoors closet, {{ user }}! </h3>
<p> Here, you can add your clothes to get your outfit suggestions using them. We've already added some clothes. Feel free to remove and add as you may.</p>
<form method="POST">
<table class="highlight">
<thead>
<tr>
<th><h2>Name</h2></th>
<th><h2>Warmth</h2></th>
<th>Name</th>
<th>Warmth</th>
</tr>
</thead>
<tbody>
Expand Down
8 changes: 5 additions & 3 deletions templates/try.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
{% block page_content %}
<div class="container">
<span id="app_info">
<h1> Try the app!</h1>
<p> Enter secret temperature desired as a number.</p>
<h3>Try ToWear!</h3>
{% if temperature %}
<h5>You can check your suggested outfit, below.</h5>
{% endif %}
<p> Note that we will use only the items in your closet; so, go ahead and add or remove items from there in the My Closet page.</p>
</span>
<span id="app_info_loading" style="display:none">
<h1> Trying the app! </h1>
<h3> Trying ToWear! Please wait...</h3>
<p> This could take up to a minute, depending on how many clothes are in your closet.</p>
</span>
<form method="POST">
Expand Down

0 comments on commit 7942122

Please sign in to comment.