From fa1e69d58b175837585a83f13dc151407dcdb895 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Wed, 18 Feb 2026 17:47:57 +0000 Subject: [PATCH] Imports to top of file. --- frontend/src/components/RemoteAuthRequest.vue | 3 +++ paskia/db/bootstrap.py | 3 +-- paskia/db/lifecycle.py | 3 +-- paskia/db/operations.py | 3 +-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/RemoteAuthRequest.vue b/frontend/src/components/RemoteAuthRequest.vue index d96d6f9..1daebef 100644 --- a/frontend/src/components/RemoteAuthRequest.vue +++ b/frontend/src/components/RemoteAuthRequest.vue @@ -163,6 +163,9 @@ async function startRemoteAuth() { // PoW challenge const powChallenge = await ws.receive_json() + if (powChallenge.status) { + throw new Error(powChallenge.detail || `Failed to connect: ${powChallenge.status}`) + } if (powChallenge.pow) { const challenge = b64dec(powChallenge.pow.challenge) const nonces = await solvePoW(challenge, powChallenge.pow.work) diff --git a/paskia/db/bootstrap.py b/paskia/db/bootstrap.py index bd5c94f..2135eec 100644 --- a/paskia/db/bootstrap.py +++ b/paskia/db/bootstrap.py @@ -7,6 +7,7 @@ from datetime import UTC, datetime import uuid7 import paskia.db.operations as _ops +from paskia.authsession import reset_expires from paskia.db.structs import Config, Org, Permission, ResetToken, Role, User from paskia.util.crypto import secret_key @@ -59,8 +60,6 @@ def bootstrap( # Set reset token expiry (passphrase generated by ResetToken.create) if reset_expiry is None: - from paskia.authsession import reset_expires # noqa: PLC0415 - reset_expiry = reset_expires() with _ops._db.transaction("bootstrap"): diff --git a/paskia/db/lifecycle.py b/paskia/db/lifecycle.py index 661d9f0..ce77eea 100644 --- a/paskia/db/lifecycle.py +++ b/paskia/db/lifecycle.py @@ -7,6 +7,7 @@ import os from datetime import UTC, datetime import paskia.db.operations as _ops +from paskia import oidc_notify from paskia.authsession import EXPIRES _logger = logging.getLogger(__name__) @@ -31,8 +32,6 @@ def cleanup_expired() -> int: limit = now - EXPIRES expired_sessions = [k for k, s in _ops._db.sessions.items() if s.validated < limit] if expired_sessions: - from paskia import oidc_notify # noqa: PLC0415 - oidc_notify.schedule_notifications(expired_sessions) with _ops._db.transaction("expiry"): for k in expired_sessions: diff --git a/paskia/db/operations.py b/paskia/db/operations.py index 8ca7bfa..bada55f 100644 --- a/paskia/db/operations.py +++ b/paskia/db/operations.py @@ -14,6 +14,7 @@ from uuid import UUID import base64url import uuid7 +from paskia import oidc_notify from paskia.config import SESSION_LIFETIME from paskia.db.jsonl import ( JsonlStore, @@ -484,7 +485,6 @@ def delete_session( """ if key not in _db.sessions: raise ValueError("Session not found") - from paskia import oidc_notify # noqa: PLC0415 oidc_notify.schedule_notifications([key]) with _db.transaction(action, ctx): @@ -503,7 +503,6 @@ def delete_sessions_for_user( user = _db.users.get(user_uuid) if not user: return - from paskia import oidc_notify # noqa: PLC0415 keys = [s.key for s in user.sessions] oidc_notify.schedule_notifications(keys)