Search code examples
ruby-on-railsauthenticationrestful-authenticationemail-validationautologin

rails auto login after email account validation with restful_authentication


I am searching for a way to auto login a user when he validates his account with a link into the email. I can't use the authenticate method because I don't have acces to the user password.

If anyone has a solution I would be happy to know it. thanks


Solution

  • Use Devise and Devise Invitable gems.

    https://github.com/scambra/devise_invitable

    Technically you are not inviting someone but what you can do is then do

    User.invite("[email protected]")  
    

    This will create tokens that allow them to login. Once they click the link it will direct them to edit their credentials.