Module: Bpluser::Registrations::InstanceMethods
- Defined in:
- app/controllers/concerns/bpluser/registrations.rb
Instance Method Summary collapse
-
#create {|resource| ... } ⇒ Object
override #create from Devise::RegistrationsController to add verify_captcha and logic for error handling this is the best way to preserve and re-render any submitted params when verify_recaptcha fails.
Instance Method Details
#create {|resource| ... } ⇒ Object
override #create from Devise::RegistrationsController to add verify_captcha and logic for error handling this is the best way to preserve and re-render any submitted params when verify_recaptcha fails
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/concerns/bpluser/registrations.rb', line 15 def create build_resource(sign_up_params) resource.save if verify_recaptcha yield resource if block_given? if resource.persisted? if resource.active_for_authentication? :notice, :signed_up sign_up(resource_name, resource) respond_with resource, location: after_sign_up_path_for(resource) else :notice, :"signed_up_but_#{resource.inactive_message}" expire_data_after_sign_in! respond_with resource, location: after_inactive_sign_up_path_for(resource) end else resource.errors.add(:errors, message: t('devise.registrations.recaptcha_error')) unless verify_recaptcha clean_up_passwords resource set_minimum_password_length respond_with resource end end |