setup user session lifetimes

main
lza_menace 4 years ago
parent 0a3f190a85
commit 4c17e2a5b0

@ -1,5 +1,6 @@
from dotenv import load_dotenv
from secrets import token_urlsafe
from datetime import timedelta
from os import getenv
@ -29,5 +30,10 @@ DB_PASS = getenv('DB_PASS')
REDIS_HOST = getenv('REDIS_HOST', 'localhost')
REDIS_PORT = getenv('REDIS_PORT', 6379)
# Sessions
SESSION_LENGTH = int(getenv('SESSION_LENGTH', 30))
PERMANENT_SESSION_LIFETIME = timedelta(minutes=SESSION_LENGTH)
MAX_CONTENT_LENGTH = 50 * 1024 * 1024
# Development
TEMPLATES_AUTO_RELOAD = True

@ -16,8 +16,8 @@ async def _setup_db(app: Quart):
def create_app():
app = Quart(__name__)
app.config.from_envvar('QUART_SECRETS')
app = cli(app)
app.config.from_envvar('QUART_SECRETS')
@app.before_serving
async def startup():
from xmrbackers.routes import meta, api, auth

@ -8,6 +8,11 @@
</ul>
</nav>
<p>Authenticated: {{ current_user.is_authenticated }}</p>
{% if current_user.is_authenticated %}
<p>Username: {{ current_user.username }}</p>
<p>Email: {{ current_user.email }}</p>
<p>Password: {{ current_user.password }}</p>
{% endif %}
</header>
<script src="/static/js/noty.js"></script>

Loading…
Cancel
Save