TheBigUsernameBlacklist (the_big_username_blacklist v0.2.0)
Elixir library for The-Big-Username-Blacklist (Opinionated username blacklist).
Configuration
You can configure global extensions in your config file:
config :the_big_username_blacklist,
extra: ~w[myapp-admin myapp-api myapp-internal]These will be applied to all validation calls and combined with any runtime options.
Summary
Functions
Returns all black listed usernames
Examples
iex> blacklist = TheBigUsernameBlacklist.get_blacklist()
iex> is_list(blacklist)
true
iex> length(blacklist)
542
iex> "admin" in blacklist
true
iex> "oauth" in blacklist
true
Check if string is included in black listed usernames
Examples
iex> TheBigUsernameBlacklist.valid?("tonystark")
true
iex> TheBigUsernameBlacklist.valid?("logout")
false
iex> TheBigUsernameBlacklist.valid?("about-me", extra: ["about-me", "contact-us"])
false
iex> TheBigUsernameBlacklist.valid?("tonystark", extra: ~w[about-me contact-us])
trueOptions
:extra- List of additional usernames to add to the blacklist
Backwards Compatibility
For backwards compatibility, passing a list directly as the second argument is still supported but deprecated:
iex> TheBigUsernameBlacklist.valid?("about-me", ["about-me", "contact-us"])
false