After Sign Up a new user I get redirected to a Sign In page with the following flash[:alert]
message:
"You need to sign in or sign up before continuing."
My User model uses Devise's :confirmable
module so it would be nice if after Sign Up a user would see a modified message instead:
"Thanks for signing up. We have sent you a confirmational email. Please check your email"
Is there a way to achieve it?
Notes about Devise workflow:
Currently a user has no idea that a confirmational email was sent to him. He will see Devise's failure message only when he tries to Log In using unconfirmed email address:
"You have to confirm your email address before continuing."
Here's solution: https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-up-(registration)
I just followed first 2 steps:
1) Create RegistrationsController:
class RegistrationsController < Devise::RegistrationsController
protected
# TODO: will this method be triggered one day?
def after_sign_up_path_for(resource)
# '/an/example/path'
new_user_session_path
end
def after_inactive_sign_up_path_for(resource)
new_user_session_path
end
end
2) Change routes to:
devise_for :users, :controllers => {:registrations => 'registrations'}
First, add devise :confirmable to your models/user.rb
Then, do the migration as:
Will generate db/migrate/YYYYMMDDxxx_add_confirmable_to_devise.rb. Add the following to it in order to do the migration.
Do the migration
rake db:migrate
If not using reconfirmable, update the configuration in config/initializers/devise.rb
Hope this will help you.