AuthShield v0.0.4 AuthShield.Authentication.LoginAttempts View Source
Every time an user try to log in its attempt is saved in order to check and temporary block after successive failed attempts.
It's done to mitigate attacks and suspicios login attempts.
Link to this section Summary
Functions
Gets a AuthShield.Authentication.Schemas.LoginAttempt register by its filters.
Gets a AuthShield.Authentication.Schemas.LoginAttempt register by its filters.
Creates a new AuthShield.Authentication.Schemas.LoginAttempt register.
Creates a new AuthShield.Authentication.Schemas.LoginAttempt register.
Returns a list of AuthShield.Authentication.Schemas.LoginAttempt by its filters
Returns a list of AuthShield.Authentication.Schemas.LoginAttempt by its user_id, status and start date.
Link to this section Types
Transactional responses of failed
success_response()
View Sourcesuccess_response() :: {:ok, AuthShield.Authentication.Schemas.LoginAttempt.t()}
Transactional responses of success
Link to this section Functions
get_by(filters)
View Sourceget_by(filters :: keyword()) :: AuthShield.Authentication.Schemas.LoginAttempt.t() | nil
Gets a AuthShield.Authentication.Schemas.LoginAttempt register by its filters.
Exemples:
AuthShield.Authentication.LoginAttempts.get_by(user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e")
get_by!(filters)
View Sourceget_by!(filters :: keyword()) :: AuthShield.Authentication.Schemas.LoginAttempt.t() | no_return()
Gets a AuthShield.Authentication.Schemas.LoginAttempt register by its filters.
Similar to get_by/1 but returns the struct or raises if the changeset is invalid.
insert(params)
View Sourceinsert(params :: map()) :: success_response() | failed_response()
Creates a new AuthShield.Authentication.Schemas.LoginAttempt register.
Exemples:
AuthShield.Authentication.LoginAttempts.insert(%{
user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e",
status: "success",
remote_ip: "173.121.3.0",
user_agent: "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0",
})
insert!(params)
View Sourceinsert!(params :: map()) :: AuthShield.Authentication.Schemas.LoginAttempt.t() | no_return()
Creates a new AuthShield.Authentication.Schemas.LoginAttempt register.
Similar to insert/1 but returns the struct or raises if the changeset is invalid.
list(filters \\ [])
View Sourcelist(filters :: keyword()) :: [ AuthShield.Authentication.Schemas.LoginAttempt.t() ]
Returns a list of AuthShield.Authentication.Schemas.LoginAttempt by its filters
Exemples:
# Getting the all list
AuthShield.Authentication.LoginAttempts.list()
# Filtering the list by field
AuthShield.Authentication.LoginAttempts.list(user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e")
list_failure(user, from_date)
View Sourcelist_failure( user :: AuthShield.Resources.Schemas.User.t(), from_date :: NaiveDateTime.t() ) :: [AuthShield.Authentication.Schemas.LoginAttempt.t()]
Returns a list of AuthShield.Authentication.Schemas.LoginAttempt by its user_id, status and start date.
Exemples:
AuthShield.Authentication.LoginAttempts.list_failure(user, ~N[2000-01-01 23:00:07])