Sha256: 67fc9288d873cd5faf3e9ae4f7d8661df9d9be07bc6743c9dff419b83b2f9b00

Contents?: true

Size: 1.15 KB

Versions: 7

Compression:

Stored size: 1.15 KB

Contents

module Ecm::UserArea
  class PasswordResets::BaseController < Ecm::UserArea::Configuration.base_controller.constantize
    include Controller::ResourceConcern
    include Controller::ResourceInflectionsConcern
    include Controller::ResourceUrlsConcern
    include Controller::RestActionsConcern
    include Controller::RedirectBackConcern
    
    if Rails.version < '5'
      skip_before_action :authenticate_user!
    else
      skip_before_action :authenticate_user!, raise: false
    end

    before_action :find_using_perishable_token

    private

    def load_resource
      @resource
    end

    def load_resource
      User.find_using_perishable_token(params[:token])
    end

    def permitted_params
      params.require(:user).permit(:password, :password_confirmation)
    end

    def after_update_location
      new_user_session_path
    end

    def handle_user_not_found
      redirect_to new_user_session_path, notice: t("messages.failures.ecm_user_area.perishable_token_invalid")
    end
    
    def find_using_perishable_token
      @resource =  User.find_using_perishable_token(params[:token])
      handle_user_not_found if @resource.nil?
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ecm_user_area2-2.3.0 app/controllers/ecm/user_area/password_resets/base_controller.rb
ecm_user_area2-2.2.0 app/controllers/ecm/user_area/password_resets/base_controller.rb
ecm_user_area2-2.0.0 app/controllers/ecm/user_area/password_resets/base_controller.rb
ecm_user_area2-1.2.10 app/controllers/ecm/user_area/password_resets/base_controller.rb
ecm_user_area2-1.2.9 app/controllers/ecm/user_area/password_resets/base_controller.rb
ecm_user_area2-1.2.8 app/controllers/ecm/user_area/password_resets/base_controller.rb
ecm_user_area2-1.2.6 app/controllers/ecm/user_area/password_resets/base_controller.rb