Class: Spree::UserConfirmationsController
- Inherits:
-
Devise::ConfirmationsController
- Object
- Devise::ConfirmationsController
- Spree::UserConfirmationsController
- Includes:
- Core::ControllerHelpers::Auth, Core::ControllerHelpers::Common, Core::ControllerHelpers::Currency, Core::ControllerHelpers::Locale, Core::ControllerHelpers::Order, Core::ControllerHelpers::Store, LocaleUrls, SpreeI18n::ControllerLocaleHelper
- Defined in:
- lib/controllers/frontend/spree/user_confirmations_controller.rb
Instance Method Summary collapse
-
#create {|resource| ... } ⇒ Object
POST /resource/confirmation.
-
#show {|resource| ... } ⇒ Object
GET /resource/confirmation?confirmation_token=abcdef.
Instance Method Details
#create {|resource| ... } ⇒ Object
POST /resource/confirmation
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/controllers/frontend/spree/user_confirmations_controller.rb', line 24 def create self.resource = resource_class.send_confirmation_instructions(resource_params, current_store) yield resource if block_given? if successfully_sent?(resource) respond_with({}, location: after_resending_confirmation_instructions_path_for(resource_name)) else respond_with(resource) end end |
#show {|resource| ... } ⇒ Object
GET /resource/confirmation?confirmation_token=abcdef
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/controllers/frontend/spree/user_confirmations_controller.rb', line 37 def show self.resource = resource_class.confirm_by_token(params[:confirmation_token]) yield resource if block_given? if resource.errors.empty? (:notice, :confirmed) (resource) do redirect_to after_confirmation_path_for(resource_name, resource) end elsif resource.confirmed? (:error, :already_confirmed) (resource) do redirect_to after_confirmation_path_for(resource_name, resource) end else (resource.errors, status: :unprocessable_entity) do render :new end end end |