26 lines
532 B
Ruby
26 lines
532 B
Ruby
require "manager_authenticator"
|
|
|
|
class Management::SessionsController < ActionController::Base
|
|
|
|
def create
|
|
destroy_session
|
|
if manager = ManagerAuthenticator.new(params).auth
|
|
session["manager"] = manager
|
|
redirect_to management_root_path
|
|
else
|
|
raise ActionController::RoutingError.new('Not Found')
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
destroy_session
|
|
redirect_to root_path, notice: t("management.sessions.signed_out")
|
|
end
|
|
|
|
private
|
|
|
|
def destroy_session
|
|
session["manager"] = nil
|
|
end
|
|
|
|
end |