views:

826

answers:

6

Is there any way I can get authlogic to send email to my subscribers after they have registered so that they can confirm their account?

A: 

It seems like this Blogpost describes what you want to achieve.

The user model uses a perishable_token which is used for a verification url sent to the user's mail adress upon account creation. When the user clicks the url in the mail it triggers an action that sets the corresponding user model to verified

Basically you need to validate UserSessions depending on whether the corresponding User is already verified.

See:

Lennart
A: 

You might find auth_helpers helpful. It's "a collection of modules and controller to extend your Authlogic models. Currently it supports Confirmable and Recoverable behavior."

Jawa
be aware that auth_helpers project appears to be abandoned by the original developer and that almost all the links in the readme are broken
srboisvert
A: 

The link suggested by Lennart is a good starting place. However a quick glance at the code reveals these caveats:

  1. Notifier#deliver_password_reset_instructions is unimplemented yet is called from User#deliver_password_reset_instructions!
  2. Notifier is a poorly named class. A Mailer generally sends notifications, so I would recommend naming the mailer class UserMailer to indicate what it is sending mail for. Also as Mailers currently reside in app/models (until Rails 3.0), appending Mailer to the class name makes it clear that it is in fact a mailer class and not an ActiveRecord model.
  3. Mailers should not be in the model. They should be in your controller actions. Ask DHH.

Good luck! Ask if you get stuck.

Steve Graham
+1  A: 

You can check the Ben Johnson's blog, the author of Authlogic. He has written awesome Tutorial: Reset passwords with Authlogic the RESTful way. Account confirmation is doing the same way and even less complex.

Voldy
A: 

Very late to the question but here is a template with authlogic email verification.

srboisvert
+1  A: 

Is there any reason why you couldn't have an UserObserver (or ActivationObserver if you have multiple authentication models - e.g., admin, user, customer service rep, etc.) that sent an email out once someone is created?

Josh