I do register with confirmation email on localhost:3000. in my development.rb i add like this
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.gmail.com',
:port => '587',
:authentication => :plain,
:user_name => 'myemail@gmail.com',
:password => 'mypassword',
:domain => 'localhost:3000',
:enable_starttls_auto => true
}
when i registers already i open my email and then in inbox show message You can confirm your account email through the link below: Confirm my account i click on this link. it redirect to localhost:3000/users/sign_in and i can login successfully .but when i click on this link (Confirm my accoun) in my inbox again .it show errors like this :
in url : http://localhost:3000/users/confirmation?confirmation_token=dWUeHVP_N7VzsVwvkNW5
meassage errors:
Resend confirmation instructions
1 error prohibited this user from being saved:
Confirmation token is invalid
in my email inbox when i click on link "Confirm my account" again i want it redirect to localhost:3000/users/sign_in. how can i redirect to localhost:3000/users/sign_in when click on link "Confirm my account " again ? please help me!
You can use confirmation link only once after confirmation confirmation_token become nil and causes this error. If you want to redirect some one to sign_in url if confirmation already done. Then you need to override devise confirmation controller.
def show
self.resource = resource_class.confirm_by_token(params[:confirmation_token])
if resource.errors.empty?
set_flash_message(:notice, :confirmed) if is_flashing_format?
sign_in(resource_name, resource)
respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
else
redirect_to new_user_session_path
#respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new }
end
end