Closed kieranwild closed 6 years ago
Hi Kieran, sorry for the slow reply. This is a good idea, let me have a quick think and I’ll get back to you.
I think the best way to handle this would be:
priv/repo/seeds.exs
, and run mix run priv/repo/seeds.exs
to insert them:{:ok, _} = YourApp.Veil.create_user("joe.blogs@example.com")
{:ok, _} = YourApp.Veil.create_user("jane.doe@example.com")
create
function in user_controller.ex
so that only existing users can log in:def create(conn, %{"user" => %{"email" => email}}) when not is_nil(email) do
if user = Veil.get_user_by_email(email) do
sign_and_email(conn, user)
else
render(conn, "new.html", changeset: User.changeset(%User{}))
end
end
Let me know what you think.
It would be really helpful if you could document how to pull a list of Authorised Users from a .env file like {:system, "AUTH_USERS"} export AUTH_USERS= ("joe.blogs@example.com", "jane.doe@example.com") So only those users can login.