riverrun / openmaize

No longer maintained - was an Authentication library for Plug-based applications in Elixir
Other
206 stars 30 forks source link

Disable confirmation #96

Closed jhonathas closed 7 years ago

jhonathas commented 7 years ago

How do I proceed so that a registration already starts confirmed and the user logged in?

I ended up creating everything with the --confirmation option, but I do not need it any more.

riverrun commented 7 years ago

There are quite a few differences between the --confirm option and the default one.

The first thing you would need to do is remove the confirmed_at field in the database. Then it will be usable, and your users will be able to log in.

I can give you more information, and a complete diff, later.

riverrun commented 7 years ago

Here's the fuller guide (as I said, there are quite a few differences):

remove the following files:

lib/welcome/mailer.ex web/controllers/password_reset_controller.ex test/controllers/password_reset_controller_test.exs web/templates/password_reset/edit.html.eex web/templates/password_reset/new.html.eex web/views/password_reset_view.ex

remove the following from the priv/repo/migrations/create_user.exs file

add :confirmed_at, :utc_datetime add :confirmation_token, :string add :confirmation_sent_at, :utc_datetime add :reset_token, :string add :reset_sent_at, :utc_datetime

remove the following from the web/models/user.ex file

field :confirmed_at, Ecto.DateTime field :confirmation_token, :string field :confirmation_sent_at, Ecto.DateTime field :reset_token, :string field :reset_sent_at, Ecto.DateTime

also remove the DB.add_confirm_token(key) line and the reset_changeset function

remove the confirm_email and password_reset routes from the web/router.ex file

remove all references to confirmation in the following files:

web/controllers/session_controller.ex web/controllers/user_controller.ex test/controllers/session_controller_test.exs test/controllers/user_controller_test.exs test/support/test_helpers.ex