Implemented with a custom failure class for devise what is the trigger to detect if a user is non confirmed? warden_message does not work. Anyone knows?
class CustomFailure < Devise::FailureApp
def redirect_url
if warden_options[:scope] == :user
new_user_registration_path
else
new_user_registration_path
end
end
def respond
if http_auth?
http_auth
else
store_location!
flash[:alert] = i18n_message unless flash[:notice]
if warden_message == :unconfirmed
redirect_to "/confirm"
else
redirect_to sign_in_path
end
end
end
end
If you want to redirect users to a custom URL, you should do it in redirect_url
, not in respond
:
def redirect_url
if warden_message == :unconfirmed
'/confirm'
else
new_user_registration_path
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With