diff --git a/lws-web/lws/app.py b/lws-web/lws/app.py index 550d095..062af1e 100644 --- a/lws-web/lws/app.py +++ b/lws-web/lws/app.py @@ -2,7 +2,7 @@ import requests import monero.address from quart import Quart, render_template, redirect, request, flash, jsonify from quart_auth import ( - AuthUser, AuthManager, login_required, login_user, current_user, Unauthorized + AuthUser, AuthManager, login_required, login_user, logout_user, current_user, Unauthorized ) from quart_bcrypt import Bcrypt from quart_session import Session @@ -75,6 +75,12 @@ async def login(): return await render_template("login.html") +@app.route("/logout") +async def logout(): + if current_user.is_authenticated: + logout_user() + return redirect("/") + @app.route("/setup", methods=["GET", "POST"]) async def setup(): if User.select().first(): diff --git a/lws-web/lws/models.py b/lws-web/lws/models.py index 0563aea..17f6cce 100644 --- a/lws-web/lws/models.py +++ b/lws-web/lws/models.py @@ -56,6 +56,11 @@ class Wallet(Model): return False def add_wallet_lws(self): + if self.check_wallet_lws() and self.added is False: + self.added = True + self.date_added = datetime.utcnow() + self.save() + return True endpoint = f"{config.LWS_ADMIN_URL}/add_account" data = { "auth": self.user.view_key, diff --git a/lws-web/lws/templates/includes/base.html b/lws-web/lws/templates/includes/base.html index e69de29..c2999a9 100644 --- a/lws-web/lws/templates/includes/base.html +++ b/lws-web/lws/templates/includes/base.html @@ -0,0 +1,53 @@ + + +
+hi {{ current_user.username }}
{% else %}hi anon
-{% endif %} \ No newline at end of file +{% endif %} +{% endblock %} + diff --git a/lws-web/lws/templates/login.html b/lws-web/lws/templates/login.html index 1842061..cd7c818 100644 --- a/lws-web/lws/templates/login.html +++ b/lws-web/lws/templates/login.html @@ -1,7 +1,6 @@ -{% for message in get_flashed_messages() %} -