Thanks, that is very good to know. Just bookmarked this page for
later use.
-J.
On Sep 4, 10:33 am, Tom Locke <[EMAIL PROTECTED]> wrote:
> Hi
>
> From a chat we had on IRC, here's a very rough guide to adding email
> activation to a hobo user account. It's not complete and might be
> broken, but it'll get you started in the right direction in lieu of a
> proper how-to.
>
> The changes from the default lifecycle are:
>
> Differences to the normal one are:
>
> New initial state 'inactive'
>
> create puts you in inactive state instead of active, and sends the email
>
> new transition - 'activate'
>
> new 'request password reset' transition, that sends the activation
> again if you're still inactive
>
> Code:
>
> # --- Signup & Activation lifecycle --- #
>
> lifecycle do
>
> initial_state :inactive
>
> state :active
>
> create :anybody, :signup,
> :params =>
> [:username, :email_address, :password, :password_confirmation],
> :become => :inactive, :if => proc {|_, u| u.guest?} do
> UserMailer.deliver_activation(self, lifecycle.generate_key)
> end
>
> transition :with_key, :activate, { :inactive => :active }
>
> transition :nobody, :request_password_reset, { :inactive
> => :inactive } do
> UserMailer.deliver_activation(self, lifecycle.generate_key)
> end
>
> transition :nobody, :request_password_reset, { :active
> => :active } do
> UserMailer.deliver_forgot_password(self, lifecycle.generate_key)
> end
>
> transition :with_key, :reset_password, { :active => :active },
> :update => [ :password, :password_confirmation ]
>
> end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---