Class: BrickLayer::SessionsController
Instance Method Summary
collapse
#authenticate, #current_administrator
Instance Method Details
#create ⇒ Object
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
|
#destroy ⇒ Object
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
|
#new ⇒ Object
6
7
|
# File 'app/controllers/brick_layer/sessions_controller.rb', line 6
def new
end
|