Class: PersonSessionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/person_sessions_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#get_login_link, #set_locale_with_config

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/person_sessions_controller.rb', line 9

def create
  @person_session = PersonSession.new(params[:person_session])
  if @person_session.save
    redirect_to_stored_location(:user)
    flash[:notice] = t('log.in.success').capitalize
  else
    flash[:error] = t('log.in.failed').capitalize
    redirect_to_stored_location do
      @user = User.new
      render :action => :new
    end
  end
end

#newObject



3
4
5
6
7
# File 'app/controllers/person_sessions_controller.rb', line 3

def new
  @person_session = PersonSession.new
  @user = User.new(params[:user])
  session[:return_to] = params[:return_to] if params[:return_to].present?
end