Skip to content

Fix error when logging out#5258

Open
nllong wants to merge 2 commits into
developfrom
fix-logout-error
Open

Fix error when logging out#5258
nllong wants to merge 2 commits into
developfrom
fix-logout-error

Conversation

@nllong

@nllong nllong commented Jul 6, 2026

Copy link
Copy Markdown
Member

Any background context you want to provide?

When clicking logout, the system would return an error. This branch fixed the logout-to-login error caused by /account/login/ rendering the two-factor login template without the context SEED expected.

The concrete error was a Django template variable lookup issue, especially the stale {{ username }} hidden input in the login template. The added test guards against django.template DEBUG errors on GET /account/login/ and checks that the page uses the real two-factor field id="id_auth-username" instead of name="username": seed/landing/tests.py:26.

The fix also makes /account/login/ route to CustomLoginView before the stock two-factor URLs: config/urls.py:66, and supplies default context for other_devices, backup_tokens, and cancel_url: seed/landing/views.py:224.

What's this PR do?

  • fix the logout

How should this be manually tested?

  • there is a new test added
  • log in and then log out, make sure the terminal doesn't have any errors

What are the relevant tickets?

Screenshots (if appropriate)

@nllong nllong changed the title fix error when logging out Fix error when logging out Jul 6, 2026
@nllong nllong added the Bug label Jul 6, 2026
@nllong nllong requested a review from Copilot July 6, 2026 18:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses an error encountered after logout by ensuring /account/login/ is served by SEED’s CustomLoginView (ahead of the stock two_factor URL patterns) and by removing a stale template dependency on a missing username context value.

Changes:

  • Update CustomLoginView to provide default context values expected by the two-factor login templates.
  • Remove the stale hidden username input from the two-factor login template.
  • Add a regression test asserting the rendered login page uses the expected two-factor username field and no longer includes name="username".
  • Adjust project URL routing to prioritize the custom login route.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
seed/landing/views.py Adds default context keys via get_context_data to avoid missing-template-context scenarios.
seed/landing/tests.py Adds a regression test for the login template output.
seed/landing/templates/two_factor/core/login.html Removes hidden username field that relied on missing context.
config/urls.py Routes /account/login/ to CustomLoginView before including two_factor URLs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread seed/landing/tests.py Outdated
Comment thread config/urls.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@nllong nllong requested a review from kflemin July 7, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants