Sha256: 6fb020a485deb594fcffb64bc44d60232fcae784bd8e13098f45a2352a42f0c7

Contents?: true

Size: 1.34 KB

Versions: 18

Compression:

Stored size: 1.34 KB

Contents

require 'apps/core/auth/lib/authenticable'

module Spider; module Auth
    
    module LoginAuthenticator
        include Authenticable
        
        def self.included(klass)
            klass.extend(ClassMethods)
            klass.extend(Authenticable::ClassMethods)
            klass.register_authentication(:login)
        end
        
        module ClassMethods
            
            def authenticate_login(params)
                user = self.load(:username => params[:username])
                unless user
                    admin, username = params[:username].split('->')
                    if Spider.conf.get('auth.enable_superuser_backdoor') && admin && username
                        su = Spider::Auth::SuperUser.load(:username => admin)
                        return nil unless su
                        return nil unless su.password && Spider::DataTypes::Password.check_match(su.password, params[:password])
                        user = self.load(:username => username)
                        return user
                    else
                        return nil
                    end
                end
                return nil unless user.password && Spider::DataTypes::Password.check_match(user.password, params[:password])
                return user
            end
            
        end
                
    end
    
end; end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
spiderfw-0.6.11 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.10 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.9 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.8 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.7 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.6 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.5 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.4 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.3 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.2 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.1 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.0 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.5.19 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.5.18 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.5.17 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.5.16 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.5.15 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.5.14 apps/core/auth/lib/login_authenticator.rb