Show flash message 'You have to confirm your account before continuing.' after sign up

1,840 views
Skip to first unread message

Matteo Pagliazzi

unread,
Apr 4, 2012, 12:43:15 PM4/4/12
to plataforma...@googlegroups.com
I have devise set up  with :confirmable but after signing up the 'You have to confirm your account before continuing.' flash isn't shown and instea the user see "You need to sign in or....".

I want to show the message about confirmation but it isn't shown.

Searching on the internet I discovered that after sign up the user is redirected to the root that in my case need authentication it self so the flash shown is the one about sign in or sign up.

How can i solve?

Should I override the method after_sign_up_path to redirect the user to something different than the root?

Carlos Antonio da Silva

unread,
Apr 4, 2012, 12:55:38 PM4/4/12
to plataforma...@googlegroups.com
You're getting a second redirect, so you're probably losing the 1st flash message. Yeah, you should override the after sign up path to redirect to sign in again, so you avoid a double redirect.

-- 
At.
Carlos Antonio

Luis Arencibia

unread,
Apr 4, 2012, 1:00:39 PM4/4/12
to plataforma...@googlegroups.com
Did you add  flash[:notice]" and "flash[:alert]"  to your views?  Try to add to the application layout as a test.

Matteo Pagliazzi

unread,
Apr 4, 2012, 1:34:11 PM4/4/12
to plataforma...@googlegroups.com
yes

Luis Arencibia

unread,
Apr 4, 2012, 2:06:09 PM4/4/12
to plataforma...@googlegroups.com
If you supply a bad password do you get an alert for that?

Matteo Pagliazzi

unread,
Apr 4, 2012, 2:25:54 PM4/4/12
to plataforma...@googlegroups.com
yes... tomorrow I'll try to override after_sign_up method and I'll post the result, thanks for now!

2012/4/4 Luis Arencibia <loui...@gmail.com>



--
Matteo Pagliazzi - paglias.net

Matteo Pagliazzi

unread,
Apr 5, 2012, 8:46:18 AM4/5/12
to plataforma...@googlegroups.com
I've overrided the Registrations Controller, defined the new one in routes.rb and then override the after_inactive_sign_up_path_for since I'm using :confirmable with this:

def after_inactive_sign_up_path_for(resource)
    redirect_to new_user_session_path
  end

but I get an error about double redirect:

Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return".

how can I solve?

Matteo Pagliazzi

unread,
Apr 5, 2012, 8:48:25 AM4/5/12
to plataforma...@googlegroups.com
Using after_sign_up_path_for instead of after_inactive_sign_up_path_for teh redirect works but the flash is always the wrong one :(


On Wednesday, April 4, 2012 6:43:15 PM UTC+2, Matteo Pagliazzi wrote:

Matteo Pagliazzi

unread,
Apr 5, 2012, 8:52:28 AM4/5/12
to plataforma...@googlegroups.com
Solved with:

def after_inactive_sign_up_path_for(resource)
    new_user_session_path
end

On Wednesday, April 4, 2012 6:43:15 PM UTC+2, Matteo Pagliazzi wrote:

Walter Lee Davis

unread,
Apr 5, 2012, 1:58:13 PM4/5/12
to plataforma...@googlegroups.com

On Apr 5, 2012, at 8:46 AM, Matteo Pagliazzi wrote:

> I've overrided the Registrations Controller, defined the new one in routes.rb and then override the after_inactive_sign_up_path_for since I'm using :confirmable with this:
>
> def after_inactive_sign_up_path_for(resource)
> redirect_to new_user_session_path
> end
>
> but I get an error about double redirect:

This method should just return the path, not actually redirect to it. So remove redirect_to from the second line, and leave everything else alone and it should work.

Walter

Maknguyen

unread,
Oct 17, 2014, 4:04:28 AM10/17/14
to plataforma...@googlegroups.com
I have same problem with wordpress wblog

Vào 09:43:15 UTC-7 Thứ tư, ngày 04 tháng tư năm 2012, Matteo Pagliazzi đã viết:
Reply all
Reply to author
Forward
0 new messages