mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Nav
This commit is contained in:
parent
da93c5da13
commit
07638d47a6
3 changed files with 56 additions and 4 deletions
|
@ -49,25 +49,51 @@ textarea {
|
|||
height: 300px;
|
||||
}
|
||||
|
||||
button, input[type="submit"] {
|
||||
button, input[type="submit"], .button {
|
||||
background-color: rgba(red(@text-color), green(@text-color), blue(@text-color), 0.1);
|
||||
border-radius: 0;
|
||||
border: 1px solid @text-color;
|
||||
color: @text-color;
|
||||
color: @text-color !important;
|
||||
padding: 2px;
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
margin: 1px;
|
||||
font-size: medium;
|
||||
font-family: sans-serif;
|
||||
text-decoration: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
button:hover, input[type="submit"]:hover {
|
||||
button:hover, input[type="submit"]:hover, .button:hover {
|
||||
background-color: rgba(red(@text-color), green(@text-color), blue(@text-color), 0.3);
|
||||
color: @accent-color;
|
||||
border: 1px solid @accent-color;
|
||||
}
|
||||
|
||||
button:active, input[type="submit"]:active, .button:active {
|
||||
background-color: rgba(red(@text-color), green(@text-color), blue(@text-color), 0.5);
|
||||
color: @accent-color !important;
|
||||
border: 1px solid @accent-color;
|
||||
|
||||
}
|
||||
|
||||
nav {
|
||||
border-bottom: 1px solid rgba(red(@text-color), green(@text-color), blue(@text-color), 0.1);
|
||||
padding: 8px;
|
||||
display: grid;
|
||||
|
||||
.left
|
||||
{
|
||||
grid-column: 1;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.right
|
||||
{
|
||||
grid-column: 2;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.input-grid {
|
||||
display: grid;
|
||||
|
||||
|
|
|
@ -10,6 +10,22 @@
|
|||
{% block posthead %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<div class="left">
|
||||
<b>Royalnet</b>
|
||||
<a href="/">Home</a>
|
||||
</div>
|
||||
<div class="right">
|
||||
<span class="login-status">
|
||||
{% if session.get('username') is not none %}
|
||||
<a href="/profile/{{ session.get('username') }}">{{ session.get('username') }}</a>
|
||||
<a class="button" href="/logout">Logout</a>
|
||||
{% else %}
|
||||
<a class="button" href="/login">Login</a>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
</nav>
|
||||
{% block body %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
10
webserver.py
10
webserver.py
|
@ -66,15 +66,25 @@ def page_loggedin():
|
|||
return
|
||||
if user.password is None:
|
||||
fl_session["user_id"] = user.id
|
||||
fl_session["username"] = username
|
||||
return redirect(url_for("page_password"))
|
||||
if bcrypt.checkpw(bytes(password, encoding="utf8"), user.password):
|
||||
fl_session["user_id"] = user.id
|
||||
fl_session["username"] = username
|
||||
return redirect(url_for("page_main"))
|
||||
else:
|
||||
abort(401)
|
||||
return
|
||||
|
||||
|
||||
@app.route("/logout")
|
||||
def page_logout():
|
||||
if "user_id" in fl_session:
|
||||
del fl_session["user_id"]
|
||||
del fl_session["username"]
|
||||
return redirect(url_for("page_main"))
|
||||
|
||||
|
||||
@app.route("/password", methods=["GET", "POST"])
|
||||
def page_password():
|
||||
user_id = fl_session.get("user_id")
|
||||
|
|
Loading…
Reference in a new issue