Sha256: b7c220cdfba22eea445f70b7fbf2b6050fd822baef4cf9d2d515a33788e6a981
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
module Refinery module Authentication module Devise class SessionsController < ::Devise::SessionsController helper Refinery::Core::Engine.helpers layout 'refinery/layouts/login' before_action :clear_unauthenticated_flash, :only => [:new] before_action :force_signup_when_no_users! skip_before_action :detect_authentication_devise_user!, only: [:create] after_action :detect_authentication_devise_user!, only: [:create] def create super rescue ::BCrypt::Errors::InvalidSalt, ::BCrypt::Errors::InvalidHash flash[:error] = t('password_encryption', :scope => 'refinery.authentication.devise.users.forgot') redirect_to refinery.new_authentication_devise_user_password_path end protected # We don't like this alert. def clear_unauthenticated_flash if flash.keys.include?(:alert) and flash.any?{ |k, v| ['unauthenticated', t('unauthenticated', :scope => 'devise.failure')].include?(v) } flash.delete(:alert) end end def force_signup_when_no_users! return if refinery_users_exist? redirect_to refinery.signup_path and return end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems