diff --git a/app.py b/app.py index 1056744..b668390 100644 --- a/app.py +++ b/app.py @@ -601,7 +601,7 @@ def verify_post_view(request): return HTTPFound(location=request.route_url("home")) -@view_config(route_name="logout") +@view_config(route_name="logout", request_method="POST", require_csrf=True) def logout_view(request): request.session.invalidate() return HTTPFound(location=request.route_url("home")) diff --git a/openapi.yaml b/openapi.yaml index c91977a..f1336e1 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -57,6 +57,11 @@ paths: responses: '302': description: Redirects to the verification page + headers: + Location: + description: URL of the verification page + schema: + type: string '400': description: Bad Request (e.g., email missing) '500': @@ -90,18 +95,32 @@ paths: responses: '302': description: Redirects to the home page upon successful verification + headers: + Location: + description: URL of the home page + schema: + type: string '400': description: Bad Request (e.g., invalid code) '500': description: Internal Server Error /auth/logout: - get: + post: summary: Logout User description: Logs out the current user. + security: + - sessionAuth: [] responses: '302': description: Redirects to the home page + headers: + Location: + description: URL of the home page + schema: + type: string + '403': + description: Unauthorized (user not logged in) /auth/profile: get: @@ -138,6 +157,11 @@ paths: responses: '302': description: Redirects to the profile page + headers: + Location: + description: URL of the profile page + schema: + type: string '400': description: Bad Request (e.g., username already in use) '403': @@ -180,6 +204,11 @@ paths: responses: '302': description: Redirects to the namespace management page + headers: + Location: + description: URL of the namespace management page + schema: + type: string '400': description: Bad Request (e.g., namespace name already exists) '403': @@ -236,6 +265,11 @@ paths: responses: '302': description: Redirects to the namespace management page + headers: + Location: + description: URL of the namespace management page + schema: + type: string '403': description: Forbidden (not owner or not logged in) '404': @@ -273,6 +307,11 @@ paths: responses: '302': description: Redirects to the namespace management page + headers: + Location: + description: URL of the namespace management page + schema: + type: string '400': description: Bad Request (e.g., invalid role) '403': @@ -345,6 +384,11 @@ paths: responses: '302': description: Redirects to the namespace management page + headers: + Location: + description: URL of the namespace management page + schema: + type: string '400': description: Bad Request (e.g., agent ID missing) '403': @@ -365,6 +409,11 @@ paths: schema: type: string description: The short ID of the namespace + - in: query + name: q + schema: + type: string + description: Search query to filter logs responses: '200': description: Logs page rendered @@ -392,10 +441,14 @@ paths: properties: message: type: string + description: The log message level: type: string + description: Log level (e.g., INFO, ERROR) + default: INFO metadata: type: object + description: Additional metadata for the log entry required: - message responses: diff --git a/templates/base.html.j2 b/templates/base.html.j2 index f6c85f6..1dda3da 100644 --- a/templates/base.html.j2 +++ b/templates/base.html.j2 @@ -44,6 +44,21 @@ color: black; } + + .logout-link-button { + background: none; + border: none; + padding: 0; + margin: 0; + color: var(--pico-primary); + text-decoration: none; + cursor: pointer; + } + + .logout-link-button:hover { + text-decoration: underline; + } + /* Hamburger Menu Button */ #mobile-menu-button { display: none; @@ -113,7 +128,12 @@ {% if request.user and request.user.is_verified %}
  • Create Namespace
  • Profile
  • -
  • Logout
  • +
  • +
    + + +
    +
  • {% else %}
  • Login
  • {% endif %} @@ -130,7 +150,12 @@ {% if request.user and request.user.is_verified %}
  • Create Namespace
  • Profile
  • -
  • Logout
  • +
  • +
    + + +
    +
  • {% else %}
  • Login
  • {% endif %}