Class: Admin::SessionsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/sessions_controller.rb

Overview

This controller handles the login/logout function of the site.

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/admin/sessions_controller.rb', line 10

def create
  self.current_user = User.authenticate(params[:login], params[:password])
  if logged_in?
    redirect_back_or_default(admin_galleries_url)
    flash[:notice] = "Logged in successfully"
  else
    flash[:notice] = "Login unsucessful"
    render :action => 'new'
  end
end

#destroyObject



21
22
23
24
25
# File 'app/controllers/admin/sessions_controller.rb', line 21

def destroy
  reset_session
  flash[:notice] = "You have been logged out."
  redirect_back_or_default('/')
end

#newObject

render new.rhtml



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

def new
  @page_title = "Connection"
end