Skip to content

London | 25-SDC-July | Ali Qassab | Module Legacy Code | Sprint 1 | Can't log in from profile page #6#41

Open
AliQassab wants to merge 2 commits intoCodeYourFuture:mainfrom
AliQassab:bug/profile-login-501-error
Open

London | 25-SDC-July | Ali Qassab | Module Legacy Code | Sprint 1 | Can't log in from profile page #6#41
AliQassab wants to merge 2 commits intoCodeYourFuture:mainfrom
AliQassab:bug/profile-login-501-error

Conversation

@AliQassab
Copy link

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Problem:
Users experienced a 501 "Server does not support this operation" error when:
Logging in → clicking a username → logging out → logging back in
Expected to see the profile page but got an error instead

Root Cause:
After logout, users remained on the profile page (#/profile/AS). When logging back in, the application tried to restore this profile page state, which triggered operations that caused the 501 error.

Solution:
Added navigation redirect to the logout function:

function logout() {
state.destroyState();
window.location.hash = "/"; // Redirect to home page
return { success: true };
}

- Redirect users to home page after logout instead of staying on profile page
- Resolves 501 error when logging in from profile page after logout
- Fixes CodeYourFuture#6
@AliQassab AliQassab added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 15, 2025
Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

This is a cute workaround, but the core of this bug report is that we're showing a component that doesn't work - if you go to http://localhost:8000/index.html#/profile/AS there's a login component that can never work (if you're not logged in).

Ideally we would make the login component work. If we can't do that, we should hide the component.

There are probably other pages that show a login form when you're not logged in, that don't work - there's probably a common underlying pattern here we need to fix.

@illicitonion illicitonion added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jan 20, 2026
@AliQassab
Copy link
Author

Thanks for the feedback. I've fixed this.

  1. Made the login component work on profile and hashtag pages
  2. Hidden profile/hashtag content when not logged in
  3. Found and fixed the same issue on hashtag pages

@illicitonion
Copy link
Member

The underlying bug looks fixed here, well done!

Mixing in the "hide content if you're not logged in", however, seems messy. Deciding to hide profile content if you're not logged in isn't related to the bug being fixed. Importantly, if we do want to hide that profile content:

  1. We should also add authentication to the backend, so people can't access it directly.
  2. We probably want to show some UI about how the profile won't be shown while you're logged out.

I'll mark this as complete because the underlying bug has been fixed, but I'd recommend reverting the "if not logged in, hide" changes from this PR.

@illicitonion
Copy link
Member

Oh also, please update your PR description - the "solution" section is no longer accurate :)

@illicitonion illicitonion added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Bug Report: Can't log in from profile page

2 participants