Raxol.Accounts (Raxol v0.2.0)
View SourceThe Accounts context. Manages user accounts and registration. (Currently uses an in-memory Agent for storage)
Summary
Functions
Authenticates a user by email and password.
Returns a specification to start this module under a supervisor.
Retrieves the full user map by user ID. Note: Inefficient O(N) scan of the agent state.
Returns the list of registered users.
Registers a new user.
Updates a user's password after verifying the current password. Uses user_id to find the user.
Functions
Authenticates a user by email and password.
Currently checks against plaintext passwords stored in the agent. In a real app, this should use password hashing.
Returns a specification to start this module under a supervisor.
See Supervisor
.
Retrieves the full user map by user ID. Note: Inefficient O(N) scan of the agent state.
Returns the list of registered users.
Registers a new user.
Examples
iex> register_user(%{email: "user@example.com", password: "password"})
{:ok, %{id: ..., email: "user@example.com"}}
iex> register_user(%{email: "user@example.com", password: "password"})
{:error, %{email: "has already been taken"}}
Updates a user's password after verifying the current password. Uses user_id to find the user.