AuthShield v0.0.2 AuthShield.Credentials.Passwords View Source
A password is an set of characters that only the user should known.
We generate an password hash in order to save de password data in our database that should be checked in authentication requests.
This module implements an interface to deal with database transactions as inserts, updates, deletes, etc.
Link to this section Summary
Functions
Checks if the given password matches with the saved password_hash
Deletes a AuthShield.Credentials.Schemas.Password
register.
Deletes a AuthShield.Credentials.Schemas.Password
register.
Gets a AuthShield.Credentials.Schemas.Password
register by its filters.
Gets a AuthShield.Credentials.Schemas.Password
register by its filters.
Creates a new AuthShield.Credentials.Schemas.Password
register.
Creates a new AuthShield.Credentials.Schemas.Password
register.
Returns a list of AuthShield.Credentials.Schemas.Password
by its filters
Updates a AuthShield.Credentials.Schemas.Password
register.
Updates a AuthShield.Credentials.Schemas.Password
register.
Link to this section Functions
check_password?(password, pass_code)
View Sourcecheck_password?( password :: AuthShield.Credentials.Schemas.Password.t(), pass_code :: String.t() ) :: boolean()
Checks if the given password matches with the saved password_hash
It calls the Argon2
to verify and returns true
if the password
matches and false
if the passwords doesn't match.
Exemples:
AuthShield.Credentials.Passwords.check_password?(password, "345617")
Deletes a AuthShield.Credentials.Schemas.Password
register.
Exemples:
AuthShield.Credentials.Passwords.delete(password)
Deletes a AuthShield.Credentials.Schemas.Password
register.
Similar to delete/1
but returns the struct or raises if the changeset is invalid.
Gets a AuthShield.Credentials.Schemas.Password
register by its filters.
Exemples:
AuthShield.Credentials.Passwords.get_by(user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e")
Gets a AuthShield.Credentials.Schemas.Password
register by its filters.
Similar to get_by/1
but returns the struct or raises if the changeset is invalid.
Creates a new AuthShield.Credentials.Schemas.Password
register.
Exemples:
AuthShield.Credentials.Passwords.insert(%{
user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e",
password: "Mypass@rd123"
})
Creates a new AuthShield.Credentials.Schemas.Password
register.
Similar to insert/1
but returns the struct or raises if the changeset is invalid.
Returns a list of AuthShield.Credentials.Schemas.Password
by its filters
Exemples:
# Getting the all list
AuthShield.Credentials.Passwords.list()
# Filtering the list by field
AuthShield.Credentials.Passwords.list(user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e")
update(password, params)
View Sourceupdate( password :: AuthShield.Credentials.Schemas.Password.t(), params :: map() ) :: {:ok, AuthShield.Credentials.Schemas.Password.t()} | {:error, Ecto.Changeset.t()}
Updates a AuthShield.Credentials.Schemas.Password
register.
Exemples:
AuthShield.Credentials.Passwords.update(password, %{
user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e",
password: "Mypass@rd123"
})
update!(password, params)
View Sourceupdate!( password :: AuthShield.Credentials.Schemas.Password.t(), params :: map() ) :: {:ok, AuthShield.Credentials.Schemas.Password.t()} | no_return()
Updates a AuthShield.Credentials.Schemas.Password
register.
Similar to update/2
but returns the struct or raises if the changeset is invalid.