mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
29 lines
709 B
Ruby
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
|