Class: SessionsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#dispatch, #get_locales, #is_dcmgr?, #set_application, #set_locale

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/sessions_controller.rb', line 13

def create
  user = User.authenticate(params[:login], params[:password])
  @error_message = ''

  if user
    self.current_user = user
    User.(user.id)
    redirect_back_or_default('/', :notice => "Logged in successfully")
  else
    @error_message = I18n.t('error_message.sign_in')
    @login = params[:login]
    render :action => 'new'
  end
end

#destroyObject



28
29
30
31
# File 'app/controllers/sessions_controller.rb', line 28

def destroy
  logout_killing_session!
  redirect_back_or_default('/', :notice => "You have been logged out.")
end

#informationObject



9
10
11
# File 'app/controllers/sessions_controller.rb', line 9

def information
  render :layout => false
end

#newObject



5
6
7
# File 'app/controllers/sessions_controller.rb', line 5

def new
  @user =  User.new
end