devise icon indicating copy to clipboard operation
devise copied to clipboard

[feat-req] Redirect after sign up.

Open frankjmattia opened this issue 16 years ago • 5 comments

I'm looking through the docs trying to find a way for sign_up to redirect to a "you've been registered, check your email for a confirmation link" type page.

Is there already a standard way of accomplishing this?

frankjmattia avatar Jun 28 '10 14:06 frankjmattia

There is not an explicit hook, but I'm sure this has been already discussed in the mailing list. If possible, please consider adding the required information to the wiki. :)

josevalim avatar Jun 28 '10 14:06 josevalim

I see now that I can override User::RegistrationsController#create which I think would accomplish my goal.

While it would be nice to have an after_sign_up_path_for(resource) I've never "contributed" with git before and haven't the faintest idea where to start to roll up my sleeves.

BUT, when I get it working with a User::RegistrationsController I will most certainly add it to the wiki.

frankjmattia avatar Jun 28 '10 14:06 frankjmattia

This works but it's not very sturdy... http://gist.github.com/456119

Is there a way to test if "confirmable" is devised? Something like (psudocode) if confirmable_is_devised redirect_to "some confirmation page" else sign_in_and_redirect(resource_name, resource) end

I imagine it would break if config.confirm_within is greater than zero. Maybe not break but it would act unexpectedly.

Lastly (third edit now), I googled my head off but it seems that everyone wants to know how to redirect but without confirmable turned on. Once confirmable is turned on and confirm_within = 0 all of the examples stop doing what I need them to do.

frankjmattia avatar Jun 28 '10 17:06 frankjmattia

confirmable_is_devised == just check if the resource responds to "confirm!"

josevalim avatar Jun 28 '10 17:06 josevalim

http://gist.github.com/456297

If you take a look at that you'll see that while it works nicely for my needs, it may break in awesome and fiery ways depending on whether or not someone is using scopes. I personally am not so it works fine. If you think it's worthy of a wiki entry I'll write something up explaining what I did.

frankjmattia avatar Jun 28 '10 20:06 frankjmattia