Class: BrickLayer::SessionsController

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

Instance Method Summary collapse

Methods inherited from BaseController

#authenticate, #current_administrator

Instance Method Details

#createObject



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

def create
  admin = BrickLayer::Administrator.authenticate(params[:username], params[:password])
  if admin
    session[:administrator_id] = admin.id.to_s
    redirect_to root_url, :notice => "Logged in!"
  else  
    flash.now.alert = "Invalid username or password"  
    render "new"  
  end
end

#destroyObject



20
21
22
23
# File 'app/controllers/brick_layer/sessions_controller.rb', line 20

def destroy
  session[:administrator_id] = nil  
  redirect_to root_url, :notice => "Logged out!"
end

#newObject



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

def new
end