I’m setting up Devise such that users can log in and use the site without having confirmed their email address, similar to this question. But there are a couple of features on the site that users can’t use unless they’ve confirmed.
OK, that’s fine. I can check for current_user.confirmed?. If they’re not confirmed, I can put a button on the page to have them request the confirmation be sent again.
The issue I’m having is that when they do this while logged in, the flash message they see on the result page is “You are already signed in.” Which isn’t ideal – I just want to put up the message that the confirmation was sent.
I’m starting down the path of trying to figure out which method of the Devise::ConfirmationController to override, and to what, but I’m hoping someone has done this already.
The reason the flash says “You are already signed in” is because the user is being redirected to
new_session_pathfrom theafter_resending_confirmation_instructions_path_formethod. I would override this method to check if they are logged in. If they are, then don’t redirect tonew_session_path, set your flash message and redirect to another page.Override the confirmations controller by putting it in
controllers/users/confirmations_controller.rbAdd your confirmationsController to routes->