1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 21:44:21 +00:00
This commit is contained in:
Steffo 2018-07-15 18:40:25 +02:00
parent da93c5da13
commit 07638d47a6
3 changed files with 56 additions and 4 deletions

View file

@ -49,25 +49,51 @@ textarea {
height: 300px; 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); background-color: rgba(red(@text-color), green(@text-color), blue(@text-color), 0.1);
border-radius: 0; border-radius: 0;
border: 1px solid @text-color; border: 1px solid @text-color;
color: @text-color; color: @text-color !important;
padding: 2px; padding: 2px;
padding-left: 8px; padding-left: 8px;
padding-right: 8px; padding-right: 8px;
margin: 1px; margin: 1px;
font-size: medium; font-size: medium;
font-family: sans-serif; 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); background-color: rgba(red(@text-color), green(@text-color), blue(@text-color), 0.3);
color: @accent-color;
border: 1px solid @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 { .input-grid {
display: grid; display: grid;

View file

@ -10,6 +10,22 @@
{% block posthead %}{% endblock %} {% block posthead %}{% endblock %}
</head> </head>
<body> <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 %} {% block body %}{% endblock %}
</body> </body>
</html> </html>

View file

@ -66,15 +66,25 @@ def page_loggedin():
return return
if user.password is None: if user.password is None:
fl_session["user_id"] = user.id fl_session["user_id"] = user.id
fl_session["username"] = username
return redirect(url_for("page_password")) return redirect(url_for("page_password"))
if bcrypt.checkpw(bytes(password, encoding="utf8"), user.password): if bcrypt.checkpw(bytes(password, encoding="utf8"), user.password):
fl_session["user_id"] = user.id fl_session["user_id"] = user.id
fl_session["username"] = username
return redirect(url_for("page_main")) return redirect(url_for("page_main"))
else: else:
abort(401) abort(401)
return 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"]) @app.route("/password", methods=["GET", "POST"])
def page_password(): def page_password():
user_id = fl_session.get("user_id") user_id = fl_session.get("user_id")