0

i intend to allow the user click on the link sent to their email address after registration to have their account activated. How do i implement this? Thank You

dev
  • 382
  • 1
  • 3
  • 17

3 Answers3

3

You can use the Devise gem to get this functionality for free: https://github.com/plataformatec/devise. See the confirmable feature: "Confirmable: sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in".

If you want to roll your own solution you should read the accepted answer to this question: Email confirmation in Rails without using any existing authentication gems/plugins.

Community
  • 1
  • 1
Peder
  • 2,739
  • 3
  • 31
  • 33
1

There are two ways to do this:

  • recode the whole stuff yourself, basically: generate a token, link it to the user's account, add a link in the mail with the token

  • or use the builtin confirmable functionality in Devise: https://github.com/plataformatec/devise

I'd head towards the second option

apneadiving
  • 114,565
  • 26
  • 219
  • 213
0

All this has be acopmlished by the use of a simple gem called devise. Just run gem install devise to install the devise gem and read the read me to checkout the cool features.

Uchenna
  • 4,059
  • 6
  • 40
  • 73