# `MishkaCmsCore.Accounts.User`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/accounts/user.ex#L5)

Manages user accounts and authentication in the MishkaCMS system.

This resource implements comprehensive user authentication using AshAuthentication,
supporting multiple strategies including password-based login, magic links, and
password reset flows. Users can be associated with specific sites for multi-tenant
isolation or exist as global users with cross-site access. The resource includes
email confirmation, token-based authentication, and session management with the
ability to log out everywhere on password changes.

Users maintain many-to-many relationships with permissions, enabling fine-grained
access control throughout the system. The resource enforces email uniqueness,
validates email formats, and ensures master user separation for system security.
Authentication tokens are stored and validated, with JWT-based token generation
for API access and session management.

The resource implements sophisticated policies for authorization, controlling who
can register users, change passwords, and access user data. It integrates with
custom senders for email notifications including confirmation emails, password
reset instructions, and magic link delivery. Multi-tenancy support ensures users
are properly isolated between sites while allowing authorized cross-site operations.

# `t`

```elixir
@type t() :: %MishkaCmsCore.Accounts.User{
  __lateral_join_source__: term(),
  __meta__: term(),
  __metadata__: term(),
  __order__: term(),
  aggregates: term(),
  calculations: term(),
  confirmed_at: term(),
  email: term(),
  hashed_password: term(),
  id: term(),
  identities: term(),
  last_totp_at: term(),
  permission_values: term(),
  permissions: term(),
  permissions_join_assoc: term(),
  recovery_codes: term(),
  site: term(),
  site_id: term(),
  totp_enabled?: term(),
  totp_secret: term(),
  totp_url_for_totp: term()
}
```

# `default_short_name`

# `input`

```elixir
@spec input(values :: map() | Keyword.t()) :: map() | no_return()
```

Validates that the keys in the provided input are valid for at least one action on the resource.

Raises a KeyError error at compile time if not. This exists because generally a struct should only ever
be created by Ash as a result of a successful action. You should not be creating records manually in code,
e.g `%MyResource{value: 1, value: 2}`. Generally that is fine, but often with embedded resources it is nice
to be able to validate the keys that are being provided, e.g

```elixir
Resource
|> Ash.Changeset.for_create(:create, %{embedded: EmbeddedResource.input(foo: 1, bar: 2)})
|> Ash.create()
```

# `input`

```elixir
@spec input(values :: map() | Keyword.t(), action :: atom()) :: map() | no_return()
```

Same as `input/1`, except restricts the keys to values accepted by the action provided.

# `json_api_match_route`

# `primary_key_matches?`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
