mirror of
https://github.com/Adam-Ant/QuotesDB
synced 2024-12-20 11:34:35 +00:00
Update to use uid_to_user everywhere
This commit is contained in:
parent
23f622fe21
commit
130584e280
6
main.py
6
main.py
@ -34,12 +34,12 @@ def gen_page(template, data=None):
|
|||||||
print("DATA")
|
print("DATA")
|
||||||
pp.pprint(data)
|
pp.pprint(data)
|
||||||
if 'username' in session:
|
if 'username' in session:
|
||||||
return render_template(template, user=session["username"], data=data)
|
return render_template(template, user=session["uid"], data=data)
|
||||||
else:
|
else:
|
||||||
return render_template(template, data=data)
|
return render_template(template, data=data)
|
||||||
|
|
||||||
if 'username' in session:
|
if 'username' in session:
|
||||||
return render_template(template, user=session["username"])
|
return render_template(template, user=session["uid"])
|
||||||
return render_template(template)
|
return render_template(template)
|
||||||
|
|
||||||
# Load User Table into variable
|
# Load User Table into variable
|
||||||
@ -239,7 +239,7 @@ def utility_processor():
|
|||||||
# This probably needs optimizing
|
# This probably needs optimizing
|
||||||
for user in userdb:
|
for user in userdb:
|
||||||
if user[0] == uid:
|
if user[0] == uid:
|
||||||
return user[1]
|
return "%s (%s)" % (user[1], user[2])
|
||||||
return dict(uid_to_user=uid_to_user)
|
return dict(uid_to_user=uid_to_user)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<label for="user">User:</label>
|
<label for="user">User:</label>
|
||||||
<select class="form-control" id="user" name="user">
|
<select class="form-control" id="user" name="user">
|
||||||
{% for user in data %}
|
{% for user in data %}
|
||||||
<option value="{{ user[0] }}">{{ user[1] }}</option>
|
<option value="{{ user[0] }}">{{ uid_to_user(user[0]) }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<a href="logout" class="btn btn-primary navbar-btn navbar-right "role="button" ><span class="glyphicon glyphicon-log-out"></span> Sign Out</a>
|
<a href="logout" class="btn btn-primary navbar-btn navbar-right "role="button" ><span class="glyphicon glyphicon-log-out"></span> Sign Out</a>
|
||||||
<a href="resetpass" class="btn btn-primary navbar-btn navbar-right "role="button" ><span class="glyphicon glyphicon-wrench"></span></a>
|
<a href="resetpass" class="btn btn-primary navbar-btn navbar-right "role="button" ><span class="glyphicon glyphicon-wrench"></span></a>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<li class="navbar-text">Hello <b> {{ user }}!</b></li>
|
<li class="navbar-text">Hello <b> {{ uid_to_user(user) }}!</b></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="login" class="btn btn-primary navbar-btn navbar-right "role="button"><span class="glyphicon glyphicon-log-in"></span> Login</a>
|
<a href="login" class="btn btn-primary navbar-btn navbar-right "role="button"><span class="glyphicon glyphicon-log-in"></span> Login</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user