View Source Lightning.Accounts.User (Lightning v2.10.4)
The User model.
Summary
Functions
Confirms the account by setting confirmed_at
.
A user changeset for user details
A user changeset for changing the email.
A user changeset for basic information
A user changeset for changing the password.
A user changeset for changing the scheduled_deletion property.
A superuser changeset for registration.
A user changeset for registration.
Verifies the password.
Validates the current password otherwise adds an error to the changeset.
Types
@type t() :: %Lightning.Accounts.User{ __meta__: term(), backup_codes: term(), confirmed_at: term(), contact_preference: term(), credentials: term(), disabled: term(), email: term(), first_name: term(), github_oauth_token: term(), hashed_password: term(), id: Ecto.UUID.t() | nil, inserted_at: term(), last_name: term(), mfa_enabled: term(), oauth_clients: term(), password: term(), preferences: term(), project_users: term(), projects: term(), role: term(), scheduled_deletion: term(), updated_at: term(), user_totp: term() }
Functions
Confirms the account by setting confirmed_at
.
A user changeset for user details:
- first_name
- last_name
- role
A user changeset for changing the email.
It requires the email to change otherwise an error is added.
A user changeset for basic information:
- first_name
- last_name
- contact_preference
A user changeset for changing the password.
Options
:hash_password
- Hashes the password so it can be stored securely in the database and ensures the password field is cleared to prevent leaks in the logs. If password hashing is not needed and clearing the password field is not desired (like when using this changeset for validations on a LiveView form), this option can be set tofalse
. Defaults totrue
.
@spec remove_github_token_changeset(t()) :: Ecto.Changeset.t()
A user changeset for changing the scheduled_deletion property.
@spec superuser_registration_changeset( :invalid | %{optional(:__struct__) => none(), optional(atom() | binary()) => any()}, keyword() ) :: Ecto.Changeset.t()
A superuser changeset for registration.
It is important to validate the length of both email and password. Otherwise databases may truncate the email without warnings, which could lead to unpredictable or insecure behaviour. Long passwords may also be very expensive to hash for certain algorithms.
Options
:hash_password
- Hashes the password so it can be stored securely in the database and ensures the password field is cleared to prevent leaks in the logs. If password hashing is not needed and clearing the password field is not desired (like when using this changeset for validations on a LiveView form), this option can be set tofalse
. Defaults totrue
.
A user changeset for registration.
It is important to validate the length of both email and password. Otherwise databases may truncate the email without warnings, which could lead to unpredictable or insecure behaviour. Long passwords may also be very expensive to hash for certain algorithms.
Options
:hash_password
- Hashes the password so it can be stored securely in the database and ensures the password field is cleared to prevent leaks in the logs. If password hashing is not needed and clearing the password field is not desired (like when using this changeset for validations on a LiveView form), this option can be set tofalse
. Defaults totrue
.
Verifies the password.
If there is no user or the user doesn't have a password, we call
Bcrypt.no_user_verify/0
to avoid timing attacks.
Validates the current password otherwise adds an error to the changeset.