Class: ThinkFeelDoEngine::Participants::PasswordsController

Inherits:
Devise::PasswordsController
  • Object
show all
Defined in:
app/controllers/think_feel_do_engine/participants/passwords_controller.rb

Overview

Customize Participant password actions.

Instance Method Summary collapse

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
31
# File 'app/controllers/think_feel_do_engine/participants/passwords_controller.rb', line 23

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

#updateObject

PUT /resource/password



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/think_feel_do_engine/participants/passwords_controller.rb', line 7

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