# RedirectToLogin

- File ID: file:82rsqa:redirecttologin-razor
- Path: NexusReader.UI.Shared/Components/RedirectToLogin.razor
- Role: ui-component
- Layer: frontend

## Purpose

Razor UI component that immediately redirects the current user to the /account/login page, preserving the current path as a returnUrl query parameter when present.

## Key Details

Performs immediate client-side redirect on initialization; preserves current relative path as an encoded returnUrl query parameter when present.

## Symbols

- OnInitialized(): Component lifecycle method that computes a relative returnUrl and redirects the browser to the login page, appending returnUrl if present.

## Dependencies

- No resolved dependencies.

## Calls

- No resolved calls.

## Unresolved References

- dependency-target: Microsoft.AspNetCore.Components.NavigationManager (framework)
- interaction-target: var returnUrl = NavigationManager.ToBaseRelativePath(NavigationManager.Uri) — reads NavigationManager.Uri and calls ToBaseRelativePath
- interaction-target: NavigationManager.NavigateTo("/account/login")
- interaction-target: NavigationManager.NavigateTo($"/account/login?returnUrl={Uri.EscapeDataString(returnUrl)}") — uses Uri.EscapeDataString to encode the return URL

## Coverage

- Symbols: 1
- Executable symbols: 1
- Executable symbols with control flow: 1
- Grounded edges: 1
- Unresolved references: 4
- Control-flow fragments: 1
- Unresolved jumps: 0
- Unsupported constructs: 0
- Control-flow coverage: 100%
- Required diagrams: 2
- Generated diagrams: 3

## Control Flow Fragments

- OnInitialized: 17 nodes, 19 edges, 0 jumps, 0 unsupported constructs

## Diagrams

### RedirectToLogin Neighborhood

```mermaid
flowchart LR
    file_82rsqa_redirecttologin_razor("RedirectToLogin")
    method_upe53r_oninitialized[["OnInitialized()"]]
```

### RedirectToLogin Execution Overview

```mermaid
flowchart TD
    file_82rsqa_redirecttologin_razor("RedirectToLogin")
    method_upe53r_oninitialized[["OnInitialized()"]]
    unresolved_unresolved_1kmwu7d_interaction_target{"Unresolved: NavigationManager.NavigateTo(\\"/account/login\\")"}
    unresolved_unresolved_1xw5601_interaction_target{"Unresolved: NavigationManager.NavigateTo($\\"/account/login?returnUrl={Uri.EscapeDataString(returnUrl)}\\") — uses Uri.EscapeDataString to encode the return URL"}
    unresolved_unresolved_7whfp5_interaction_target{"Unresolved: var returnUrl = NavigationManager.ToBaseRelativePath(NavigationManager.Uri) — reads NavigationManager.Uri and calls ToBaseRelativePath"}
    file_82rsqa_redirecttologin_razor -->|contains| method_upe53r_oninitialized
    file_82rsqa_redirecttologin_razor -->|unresolved interaction| unresolved_unresolved_1kmwu7d_interaction_target
    file_82rsqa_redirecttologin_razor -->|unresolved interaction| unresolved_unresolved_1xw5601_interaction_target
    file_82rsqa_redirecttologin_razor -->|unresolved interaction| unresolved_unresolved_7whfp5_interaction_target
```

### OnInitialized() Control Flow

```mermaid
flowchart TD
    method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__condition{"Falls back to alternate path"}
    method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__false("otherwise")
    method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__merge("merge")
    method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__true("fallback")
    method_upe53r_oninitialized__action_7_guard_clause_7__condition{"string.IsNullOrWhiteSpace(returnUrl)"}
    method_upe53r_oninitialized__action_7_guard_clause_7__false("navigate to /account/login?returnUrl=... (with escaped returnUrl)")
    method_upe53r_oninitialized__action_7_guard_clause_7__merge("merge")
    method_upe53r_oninitialized__action_7_guard_clause_7__true("navigate to /account/login (no returnUrl)")
    method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__condition{"string.IsNullOrWhiteSpace(returnUrl)"}
    method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__false("false")
    method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__merge("merge")
    method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__true("true")
    method_upe53r_oninitialized__entry(["OnInitialized entry"])
    method_upe53r_oninitialized__action_13_external_call_13__linear("Navigate to login with encoded returnUrl")
    method_upe53r_oninitialized__action_6_external_call_6__linear("Read current URI and compute base-relative path")
    method_upe53r_oninitialized__action_9_external_call_9__linear("Navigate to login without returnUrl")
    method_upe53r_oninitialized__implicit_return(["return"])
    method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__condition -->|otherwise| method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__false
    method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__condition -->|fallback| method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__true
    method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__false -->|next| method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__merge
    method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__merge -->|next| method_upe53r_oninitialized__action_13_external_call_13__linear
    method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__true -->|next| method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__merge
    method_upe53r_oninitialized__action_13_external_call_13__linear -->|return| method_upe53r_oninitialized__implicit_return
    method_upe53r_oninitialized__action_6_external_call_6__linear -->|next| method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__condition
    method_upe53r_oninitialized__action_7_guard_clause_7__condition -->|transforms input| method_upe53r_oninitialized__action_7_guard_clause_7__false
    method_upe53r_oninitialized__action_7_guard_clause_7__condition -->|navigate to / account / login no returnUrl| method_upe53r_oninitialized__action_7_guard_clause_7__true
    method_upe53r_oninitialized__action_7_guard_clause_7__false -->|next| method_upe53r_oninitialized__action_7_guard_clause_7__merge
    method_upe53r_oninitialized__action_7_guard_clause_7__merge -->|next| method_upe53r_oninitialized__action_9_external_call_9__linear
    method_upe53r_oninitialized__action_7_guard_clause_7__true -->|next| method_upe53r_oninitialized__action_7_guard_clause_7__merge
    method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__condition -->|false| method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__false
    method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__condition -->|true| method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__true
    method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__false -->|next| method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__merge
    method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__merge -->|next| method_upe53r_oninitialized__action_7_guard_clause_7__condition
    method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__true -->|next| method_upe53r_oninitialized__action_7_oninitialized_branch_7_0__merge
    method_upe53r_oninitialized__action_9_external_call_9__linear -->|fallback| method_upe53r_oninitialized__action_11_oninitialized_fallback_11_1__condition
    method_upe53r_oninitialized__entry -->|next| method_upe53r_oninitialized__action_6_external_call_6__linear
```

## Diagram Validation

- Status: pass
