Completed
Push — master ( 076eda...79da31 )
by
unknown
11s
created

participant_session_params()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
class UserSessionsController < ApplicationController
2
  def new
3
    @participant_session = ParticipantSession.new
4
  end
5
6
  def create
7
    @participant_session = ParticipantSession.new(participant_session_params)
8
    if @participant_session.save
9
      flash[:notice] = "You're logged in. Welcome back."
10
      redirect_to root_path
11
    else
12
      flash.now[:error] = "Sorry, couldn't find that participant. Try again, or sign up to register a new account."
13
      render :action => :new
14
    end
15
  end
16
17
  def destroy
18
    current_participant_session.destroy
19
20
    flash[:notice] = 'You have been logged out.'
21
    redirect_to root_path
22
  end
23
24
   private
25
26
  def participant_session_params
27
    params.require(:participant_session).permit(:email, :password)
28
  end
29
30
end
31