Sha256: 5b18c1e553ca627e1f2f70af34de8da9f6a86126475f858a0f813d3b02e2c857

Contents?: true

Size: 1.39 KB

Versions: 30

Compression:

Stored size: 1.39 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])
                return nil unless 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

30 entries across 30 versions & 1 rubygems

Version Path
spiderfw-1.0.1 apps/core/auth/lib/login_authenticator.rb
spiderfw-1.0.0 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.39 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.38 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.37 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.35 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.34 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.33 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.32 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.31 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.30 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.29 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.28 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.27 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.26 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.26.pre1 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.25 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.24 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.23 apps/core/auth/lib/login_authenticator.rb
spiderfw-0.6.22 apps/core/auth/lib/login_authenticator.rb