Sha256: 97fd269394275f3df53e2b3a4596024ad5ae159d5a6e5cadf872fb50e5dc2f87
Contents?: true
Size: 1014 Bytes
Versions: 6
Compression:
Stored size: 1014 Bytes
Contents
if File.exist?(Rails.root.join("controllers/application_controller")) require "application_controller" end class SessionsController < (defined?(ApplicationController) ? ApplicationController : ActionController::Base) before_action :destroy_session, except: :create # GET /login # GET /sign-in def new @session = Challah::Session.new(request) end # POST /login # POST /sign-in def create @session = Challah::Session.new(request, params[:session]) @session.ip = request.remote_ip if @session.save redirect_to return_to_path else redirect_to signin_path, alert: I18n.translate('sessions.create.failed_login') end end # GET /logout # GET /sign-out def destroy redirect_to signin_path end protected def destroy_session current_user_session.destroy end def return_to_path(default_path = '/') result = session[:return_to] result = nil if result and result == "http://#{request.domain}/" result || default_path end end
Version data entries
6 entries across 6 versions & 1 rubygems