1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/app/controllers/sessions_controller.rb
2009-10-11 23:24:57 -03:00

29 lines
709 B
Ruby

class SessionsController < ApplicationController
before_filter :find_resource_class
# GET /session/sign_in
# TODO Test me
def new
set_flash_message :failure, params[:message].to_sym, true if params[:message]
end
# POST /session/sign_in
def create
if warden.authenticate(:scope => resource_name)
set_flash_message :success, :signed_in
redirect_to root_path
else
set_flash_message :failure, :unauthenticated, true
render :new
end
end
# GET /session/sign_out
# DELETE /session/sign_out
def destroy
logout(resource_name)
# TODO Do not show me unless logged in
set_flash_message :success, :signed_out
redirect_to root_path
end
end