Class: AuthController

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

Constant Summary

Constants included from PaginationHelper

PaginationHelper::DEFAULT_OPTIONS, PaginationHelper::OPTIONS

Instance Method Summary collapse

Methods included from PaginationHelper

included, #paginate, validate_options!

Instance Method Details

#indexObject



2
3
4
5
# File 'app/controllers/auth_controller.rb', line 2

def index
  
  render_action 'login'
end

#loginObject



7
8
9
10
11
12
13
14
15
# File 'app/controllers/auth_controller.rb', line 7

def 
  if @request.post?
    if user = User.authenticate(@params['username'], @params['password'])
      start_user_session(user)
      redirect_to_main
      return
    end
  end
end

#logoutObject

logout() removes the session information set in login() and then deletes the session. The browser is then redirected to the log in form.



19
20
21
22
# File 'app/controllers/auth_controller.rb', line 19

def logout
  end_user_session
  redirect_to_main
end