Sha256: f59984efe7184fc80c354e50f7a4361821db47a4e7bbe17afb5e6678c9a6294c
Contents?: true
Size: 966 Bytes
Versions: 6
Compression:
Stored size: 966 Bytes
Contents
class Clearance::SessionsController < Clearance::BaseController before_filter :redirect_signed_in_users, only: [:new] skip_before_filter :require_login, only: [:create, :new, :destroy] skip_before_filter :authorize, only: [:create, :new, :destroy] def create @user = authenticate(params) sign_in(@user) do |status| if status.success? redirect_back_or url_after_create else flash.now.notice = status.failure_message render template: "sessions/new", status: :unauthorized end end end def destroy sign_out redirect_to url_after_destroy end def new render template: "sessions/new" end private def redirect_signed_in_users if signed_in? redirect_to url_for_signed_in_users end end def url_after_create Clearance.configuration.redirect_url end def url_after_destroy sign_in_url end def url_for_signed_in_users url_after_create end end
Version data entries
6 entries across 6 versions & 1 rubygems