Sha256: b3a616b01bd7799d2e14a8a947c1753267c9269358ff18e9a099f0922cbc0170

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true
module ThinkFeelDoEngine
  module Participants
    # Customize Participant password actions.
    class PasswordsController < Devise::PasswordsController
      # PUT /resource/password
      def update
        participant = Participant
                      .with_reset_password_token(
                        params[:participant][:reset_password_token]
                      )
        if participant && !participant.active_membership
          msg = "We're sorry, but you can't sign in yet because you are not " \
                "assigned to an active group."
          redirect_to new_participant_session_path, alert: msg
        else
          super do |resource|
            ParticipantLoginEvent.create(participant_id: resource.id)
          end
        end
      end

      def create
        @participant = Participant.find_by(email: resource_params[:email])
        if @participant.try(:not_allowed_in_site?)
          msg = "New password cannot be sent; this account is not active."
          redirect_to new_participant_session_path, alert: msg
        else
          super
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.22.8 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.22.7 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.22.6 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.22.5 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.22.4 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.22.2 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.22.1 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.22.0 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.21.2 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.21.1 app/controllers/think_feel_do_engine/participants/passwords_controller.rb
think_feel_do_engine-3.21.0 app/controllers/think_feel_do_engine/participants/passwords_controller.rb