# Register

- File ID: file:1hn70tz:register-razor
- Path: NexusReader.UI.Shared/Pages/Account/Register.razor
- Role: ui-page
- Layer: frontend

## Purpose

Blazor Razor page that renders a registration form, handles client-side validation and orchestrates user registration and immediate sign-in via injected identity service and a JS helper to complete cookie-based sign-in.

## Key Details

Uses an injected identity service for register/login and a JS helper to submit a hidden POST form to perform cookie-based sign-in; shows validation and error messages, and guards concurrent submissions with _isSubmitting.

## Symbols

- HandleRegister(): Handles the registration form submission: calls identity service to register, attempts immediate login, triggers a hidden form submission via JS to establish cookie-based auth, and surfaces errors to the UI.
- RegisterModel: Model bound to the registration form with validation attributes for email and password fields.

## Dependencies

- imports NexusReader.UI.Shared/Components/Atoms/NexusIcon.razor

## Calls

- No resolved calls.

## Unresolved References

- dependency-target: NexusReader.UI.Shared/Services/IIdentityService.cs
- call-target: NexusReader.UI.Shared/Services/IIdentityService.cs
- call-target: NexusReader.UI.Shared/Services/IIdentityService.cs
- interaction-target: _errorMessage = regResult.Errors.FirstOrDefault()?.Message ?? "Rejestracja nie powiodła się.";
- interaction-target: await IdentityService.RegisterAsync(email, password)
- interaction-target: await IdentityService.LoginAsync(email, password)

## Coverage

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

## Control Flow Fragments

- HandleRegister: 45 nodes, 50 edges, 2 jumps, 0 unsupported constructs

## Diagrams

### Register Neighborhood

```mermaid
flowchart LR
    file_1hn70tz_register_razor("Register")
    method_mj67eu_handleregister[["HandleRegister()"]]
    file_q8opk3_nexusicon_razor[/"NexusIcon"/]
    type_gonkkw_registermodel[/"RegisterModel"/]
    file_1hn70tz_register_razor -->|NexusIcon| file_q8opk3_nexusicon_razor
```

### Register Execution Overview

```mermaid
flowchart TD
    file_1hn70tz_register_razor("Register")
    method_mj67eu_handleregister[["HandleRegister()"]]
    unresolved_unresolved_1cgrf4i_interaction_target{"Unresolved: _errorMessage = regResult.Errors.FirstOrDefault()?.Message ?? \\"Rejestracja nie powiodła się.\\";"}
    unresolved_unresolved_1r49zo3_call_target{"Unresolved: LoginAsync"}
    unresolved_unresolved_1rtaa2f_call_target{"Unresolved: RegisterAsync"}
    unresolved_unresolved_1tsa04x_interaction_target{"Unresolved: await IdentityService.RegisterAsync(email, password)"}
    unresolved_unresolved_nopu59_interaction_target{"Unresolved: await IdentityService.LoginAsync(email, password)"}
    file_1hn70tz_register_razor -->|contains| method_mj67eu_handleregister
    file_1hn70tz_register_razor -->|unresolved interaction| unresolved_unresolved_1cgrf4i_interaction_target
    file_1hn70tz_register_razor -->|unresolved interaction| unresolved_unresolved_1tsa04x_interaction_target
    file_1hn70tz_register_razor -->|unresolved interaction| unresolved_unresolved_nopu59_interaction_target
    method_mj67eu_handleregister -->|unresolved call| unresolved_unresolved_1r49zo3_call_target
    method_mj67eu_handleregister -->|unresolved call| unresolved_unresolved_1rtaa2f_call_target
```

### HandleRegister() Control Flow

_Warnings: diagram method_mj67eu_handleregister__fragment_diagram exceeds preferred complexity thresholds (45 nodes, 50 edges)._

```mermaid
---
config:
  flowchart:
    defaultRenderer: "elk"
---
flowchart TD
    method_mj67eu_handleregister__call_91_RegisterAsync[["RegisterAsync"]]
    method_mj67eu_handleregister__call_94_LoginAsync[["LoginAsync"]]
    method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__condition{"Falls back to alternate path"}
    method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__false("otherwise")
    method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__merge("merge")
    method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__true("fallback")
    method_mj67eu_handleregister__action_102_navigation_102__linear("fallback navigate to login page")
    method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__condition{"Falls back to alternate path"}
    method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__false("otherwise")
    method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__merge("merge")
    method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__true("fallback")
    method_mj67eu_handleregister__action_107_set_error_107__linear("set registration error from service")
    method_mj67eu_handleregister__action_110_handleregister_catch_110_9__catch("catch Exception")
    method_mj67eu_handleregister__action_111_exception_handle_111__linear("generic error on exception")
    method_mj67eu_handleregister__action_114_handleregister_finally_114_10__finally("Runs cleanup or finalization")
    method_mj67eu_handleregister__action_116_state_change_116__linear("clear submitting flag")
    method_mj67eu_handleregister__action_86_state_change_86__linear("mark submitting")
    method_mj67eu_handleregister__action_87_state_change_87__linear("clear error")
    method_mj67eu_handleregister__action_89_handleregister_try_89_0__try("Begins protected execution")
    method_mj67eu_handleregister__action_89_try_catch_finally_89__linear("wraps registration and login")
    method_mj67eu_handleregister__action_91_handleregister_await_91_1__await[["Waits for async work"]]
    method_mj67eu_handleregister__action_92_branch_92__condition{"regResult.IsSuccess"}
    method_mj67eu_handleregister__action_92_branch_92__false("failure -> show error")
    method_mj67eu_handleregister__action_92_branch_92__merge("merge")
    method_mj67eu_handleregister__action_92_branch_92__true("success -> attempt login")
    method_mj67eu_handleregister__action_92_handleregister_branch_92_2__condition{"regResult.IsSuccess"}
    method_mj67eu_handleregister__action_92_handleregister_branch_92_2__false("false")
    method_mj67eu_handleregister__action_92_handleregister_branch_92_2__merge("merge")
    method_mj67eu_handleregister__action_92_handleregister_branch_92_2__true("true")
    method_mj67eu_handleregister__action_94_handleregister_await_94_3__await[["Waits for async work"]]
    method_mj67eu_handleregister__action_95_branch_95__condition{"loginResult.IsSuccess"}
    method_mj67eu_handleregister__action_95_branch_95__false("failure -> navigate to login page")
    method_mj67eu_handleregister__action_95_branch_95__merge("merge")
    method_mj67eu_handleregister__action_95_branch_95__true("success -> submit hidden form via JS")
    method_mj67eu_handleregister__action_95_handleregister_branch_95_4__condition{"loginResult.IsSuccess"}
    method_mj67eu_handleregister__action_95_handleregister_branch_95_4__false("false")
    method_mj67eu_handleregister__action_95_handleregister_branch_95_4__merge("merge")
    method_mj67eu_handleregister__action_95_handleregister_branch_95_4__true("true")
    method_mj67eu_handleregister__action_98_external_js_98__linear("submit hidden login form for cookie sign-in")
    method_mj67eu_handleregister__action_98_handleregister_await_98_5__await[["Waits for async work"]]
    method_mj67eu_handleregister__entry(["HandleRegister entry"])
    method_mj67eu_handleregister__action_107_handleregister_repository_read_107_8__linear[("Reads repository or persistence state")]
    method_mj67eu_handleregister__action_91_external_call_91__linear("register user")
    method_mj67eu_handleregister__action_94_external_call_94__linear("login user (programmatic)")
    method_mj67eu_handleregister__implicit_return(["return"])
    method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__condition -->|otherwise| method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__false
    method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__condition -->|fallback| method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__true
    method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__false -->|next| method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__merge
    method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__merge -->|next| method_mj67eu_handleregister__action_102_navigation_102__linear
    method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__true -->|next| method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__merge
    method_mj67eu_handleregister__action_102_navigation_102__linear -->|fallback| method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__condition
    method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__condition -->|otherwise| method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__false
    method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__condition -->|fallback| method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__true
    method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__false -->|next| method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__merge
    method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__merge -->|next| method_mj67eu_handleregister__action_107_set_error_107__linear
    method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__true -->|next| method_mj67eu_handleregister__action_105_handleregister_fallback_105_7__merge
    method_mj67eu_handleregister__action_107_handleregister_repository_read_107_8__linear -->|exception| method_mj67eu_handleregister__action_110_handleregister_catch_110_9__catch
    method_mj67eu_handleregister__action_107_set_error_107__linear -->|next| method_mj67eu_handleregister__action_107_handleregister_repository_read_107_8__linear
    method_mj67eu_handleregister__action_110_handleregister_catch_110_9__catch -->|next| method_mj67eu_handleregister__action_111_exception_handle_111__linear
    method_mj67eu_handleregister__action_111_exception_handle_111__linear -->|next| method_mj67eu_handleregister__action_114_handleregister_finally_114_10__finally
    method_mj67eu_handleregister__action_114_handleregister_finally_114_10__finally -->|next| method_mj67eu_handleregister__action_116_state_change_116__linear
    method_mj67eu_handleregister__action_116_state_change_116__linear -->|return| method_mj67eu_handleregister__implicit_return
    method_mj67eu_handleregister__action_86_state_change_86__linear -->|next| method_mj67eu_handleregister__action_87_state_change_87__linear
    method_mj67eu_handleregister__action_87_state_change_87__linear -->|next| method_mj67eu_handleregister__action_89_try_catch_finally_89__linear
    method_mj67eu_handleregister__action_89_handleregister_try_89_0__try -->|next| method_mj67eu_handleregister__action_91_handleregister_await_91_1__await
    method_mj67eu_handleregister__action_89_try_catch_finally_89__linear -->|next| method_mj67eu_handleregister__action_89_handleregister_try_89_0__try
    method_mj67eu_handleregister__action_91_external_call_91__linear -->|calls| method_mj67eu_handleregister__call_91_RegisterAsync
    method_mj67eu_handleregister__action_91_handleregister_await_91_1__await -->|next| method_mj67eu_handleregister__action_91_external_call_91__linear
    method_mj67eu_handleregister__action_92_branch_92__condition -->|failure -> show error| method_mj67eu_handleregister__action_92_branch_92__false
    method_mj67eu_handleregister__action_92_branch_92__condition -->|success -> attempt login| method_mj67eu_handleregister__action_92_branch_92__true
    method_mj67eu_handleregister__action_92_branch_92__false -->|next| method_mj67eu_handleregister__action_92_branch_92__merge
    method_mj67eu_handleregister__action_92_branch_92__merge -->|next| method_mj67eu_handleregister__action_92_handleregister_branch_92_2__condition
    method_mj67eu_handleregister__action_92_branch_92__true -->|next| method_mj67eu_handleregister__action_92_branch_92__merge
    method_mj67eu_handleregister__action_92_handleregister_branch_92_2__condition -->|false| method_mj67eu_handleregister__action_92_handleregister_branch_92_2__false
    method_mj67eu_handleregister__action_92_handleregister_branch_92_2__condition -->|true| method_mj67eu_handleregister__action_92_handleregister_branch_92_2__true
    method_mj67eu_handleregister__action_92_handleregister_branch_92_2__false -->|next| method_mj67eu_handleregister__action_92_handleregister_branch_92_2__merge
    method_mj67eu_handleregister__action_92_handleregister_branch_92_2__merge -->|next| method_mj67eu_handleregister__action_94_handleregister_await_94_3__await
    method_mj67eu_handleregister__action_92_handleregister_branch_92_2__true -->|next| method_mj67eu_handleregister__action_92_handleregister_branch_92_2__merge
    method_mj67eu_handleregister__action_94_external_call_94__linear -->|calls| method_mj67eu_handleregister__call_94_LoginAsync
    method_mj67eu_handleregister__action_94_handleregister_await_94_3__await -->|next| method_mj67eu_handleregister__action_94_external_call_94__linear
    method_mj67eu_handleregister__action_95_branch_95__condition -->|failure -> navigate to login page| method_mj67eu_handleregister__action_95_branch_95__false
    method_mj67eu_handleregister__action_95_branch_95__condition -->|success -> submit hidden form via JS| method_mj67eu_handleregister__action_95_branch_95__true
    method_mj67eu_handleregister__action_95_branch_95__false -->|next| method_mj67eu_handleregister__action_95_branch_95__merge
    method_mj67eu_handleregister__action_95_branch_95__merge -->|next| method_mj67eu_handleregister__action_95_handleregister_branch_95_4__condition
    method_mj67eu_handleregister__action_95_branch_95__true -->|next| method_mj67eu_handleregister__action_95_branch_95__merge
    method_mj67eu_handleregister__action_95_handleregister_branch_95_4__condition -->|false| method_mj67eu_handleregister__action_95_handleregister_branch_95_4__false
    method_mj67eu_handleregister__action_95_handleregister_branch_95_4__condition -->|true| method_mj67eu_handleregister__action_95_handleregister_branch_95_4__true
    method_mj67eu_handleregister__action_95_handleregister_branch_95_4__false -->|next| method_mj67eu_handleregister__action_95_handleregister_branch_95_4__merge
    method_mj67eu_handleregister__action_95_handleregister_branch_95_4__merge -->|next| method_mj67eu_handleregister__action_98_handleregister_await_98_5__await
    method_mj67eu_handleregister__action_95_handleregister_branch_95_4__true -->|next| method_mj67eu_handleregister__action_95_handleregister_branch_95_4__merge
    method_mj67eu_handleregister__action_98_external_js_98__linear -->|fallback| method_mj67eu_handleregister__action_100_handleregister_fallback_100_6__condition
    method_mj67eu_handleregister__action_98_handleregister_await_98_5__await -->|next| method_mj67eu_handleregister__action_98_external_js_98__linear
    method_mj67eu_handleregister__call_91_RegisterAsync -->|next| method_mj67eu_handleregister__action_92_branch_92__condition
    method_mj67eu_handleregister__call_94_LoginAsync -->|next| method_mj67eu_handleregister__action_95_branch_95__condition
    method_mj67eu_handleregister__entry -->|next| method_mj67eu_handleregister__action_86_state_change_86__linear
```

## Diagram Validation

- Status: warn
- Warning: Control-flow extraction left 2 unresolved jumps.
- Warning: control-flow: diagram method_mj67eu_handleregister__fragment_diagram exceeds preferred complexity thresholds (45 nodes, 50 edges).
