Answer the question
In order to leave comments, you need to log in
How to insert recaptcha into email confirmation?
rails 4.2.1, devise 3.5.1, recaptcha 0.4.0
Managed to embed recaptcha in user registration:
/app/controllers/users/registrations_controller.rb:
class Users::RegistrationsController < Devise::RegistrationsController
# POST /resource
def create
if verify_recaptcha
super
else
build_resource(sign_up_params)
clean_up_passwords(resource)
flash.now[:alert] = "Ошибка в коде с картинки."
flash.delete :recaptcha_error
render :new
end
end
end
/app/controllers/users/confirmations_controller.rb:
class Users::ConfirmationsController < Devise::ConfirmationsController
# POST /resource/confirmation
def create
if verify_recaptcha
super
else
flash.now[:alert] = "Ошибка в коде с картинки."
flash.delete :recaptcha_error
render :new
end
end
end
Answer the question
In order to leave comments, you need to log in
Forgot)
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks",
:registrations => "users/registrations",
:confirmations => "users/confirmations" }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question