fix: Bug - User login status showing as both logged in and logged out
Stop treating transient auth_required as home-session expiry, keep auth scope consistent across login redirect and server-rail joins, and leave /login when the in-memory user is still authenticated. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -28,6 +28,8 @@ import {
|
||||
|
||||
import { Room, User } from '../../../shared-kernel';
|
||||
import { buildLoginReturnQueryParams } from '../../../domains/authentication/domain/logic/auth-navigation.rules';
|
||||
import { resolveAuthenticatedLocalUserId } from '../../../domains/authentication/domain/logic/auth-session.rules';
|
||||
import { setStoredCurrentUserId } from '../../../core/storage/current-user-storage';
|
||||
import { UserBarComponent } from '../../../domains/authentication/feature/user-bar/user-bar.component';
|
||||
import { VoiceSessionFacade } from '../../../domains/voice-session';
|
||||
import { selectSavedRooms, selectCurrentRoom } from '../../../store/rooms/rooms.selectors';
|
||||
@@ -274,7 +276,11 @@ export class ServersRailComponent {
|
||||
|
||||
joinSavedRoom(room: Room): void {
|
||||
const targetRoom = this.savedRooms().find((savedRoom) => savedRoom.id === room.id) ?? room;
|
||||
const currentUserId = localStorage.getItem('metoyou_currentUserId');
|
||||
const currentUser = this.currentUser();
|
||||
const currentUserId = resolveAuthenticatedLocalUserId(
|
||||
localStorage.getItem('metoyou_currentUserId'),
|
||||
currentUser
|
||||
);
|
||||
|
||||
if (!currentUserId) {
|
||||
this.router.navigate(['/login'], {
|
||||
@@ -284,6 +290,10 @@ export class ServersRailComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentUser) {
|
||||
setStoredCurrentUserId(currentUser.id);
|
||||
}
|
||||
|
||||
if (this.isRoomMarkedBanned(targetRoom)) {
|
||||
this.bannedServerName.set(targetRoom.name);
|
||||
this.showBannedDialog.set(true);
|
||||
@@ -585,12 +595,19 @@ export class ServersRailComponent {
|
||||
}
|
||||
|
||||
private requestJoinInBackground(room: Room, password?: string) {
|
||||
const currentUserId = localStorage.getItem('metoyou_currentUserId');
|
||||
const currentUser = this.currentUser();
|
||||
const currentUserId = resolveAuthenticatedLocalUserId(
|
||||
localStorage.getItem('metoyou_currentUserId'),
|
||||
currentUser
|
||||
);
|
||||
|
||||
if (!currentUserId)
|
||||
return EMPTY;
|
||||
|
||||
if (currentUser) {
|
||||
setStoredCurrentUserId(currentUser.id);
|
||||
}
|
||||
|
||||
this.joinPasswordError.set(null);
|
||||
|
||||
return from(this.resolveRoomJoinTarget(room)).pipe(
|
||||
|
||||
Reference in New Issue
Block a user