Improved logging.
This commit is contained in:
parent
3046a07948
commit
a5b8f28e8e
7 changed files with 19 additions and 12 deletions
|
@ -194,6 +194,7 @@ returns
|
||||||
# check failed logins
|
# check failed logins
|
||||||
max_login_failed = Setting.get('password_max_login_failed').to_i || 10
|
max_login_failed = Setting.get('password_max_login_failed').to_i || 10
|
||||||
if user && user.login_failed > max_login_failed
|
if user && user.login_failed > max_login_failed
|
||||||
|
logger.info "Max login faild reached for user #{user.login}."
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ returns
|
||||||
# auth ok
|
# auth ok
|
||||||
if user_auth
|
if user_auth
|
||||||
|
|
||||||
|
Rails.logger.info "Authentication against #{config_item[:adapter]} for user #{user.login} ok."
|
||||||
|
|
||||||
# remember last login date
|
# remember last login date
|
||||||
user_auth.update_last_login
|
user_auth.update_last_login
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,10 @@ module Auth::Developer
|
||||||
|
|
||||||
# development systems
|
# development systems
|
||||||
if Setting.get('developer_mode') == true
|
if Setting.get('developer_mode') == true
|
||||||
return user if password == 'test'
|
if password == 'test'
|
||||||
|
Rails.logger.info "System in developer mode, authentication for user #{user.login} ok."
|
||||||
|
return user
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
false
|
false
|
||||||
|
|
|
@ -18,11 +18,11 @@ module Auth::Ldap
|
||||||
# ldap bind
|
# ldap bind
|
||||||
begin
|
begin
|
||||||
if !ldap.bind
|
if !ldap.bind
|
||||||
puts "NOTICE: Can't bind to '#{config[:host]}', #{ldap.get_operation_result.code}, #{ldap.get_operation_result.message}"
|
Rails.logger.info "Can't bind to '#{config[:host]}', #{ldap.get_operation_result.code}, #{ldap.get_operation_result.message}"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "NOTICE: Can't connect to '#{config[:host]}', #{e.to_s}"
|
Rails.logger.info "Can't connect to '#{config[:host]}', #{e.to_s}"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -47,14 +47,14 @@ module Auth::Ldap
|
||||||
end
|
end
|
||||||
|
|
||||||
if user_dn == nil
|
if user_dn == nil
|
||||||
puts "NOTICE: ldap entry found for user '#{username}' with filter #{filter} failed!"
|
Rails.logger.info "ldap entry found for user '#{username}' with filter #{filter} failed!"
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# try ldap bind with user credentals
|
# try ldap bind with user credentals
|
||||||
auth = ldap.authenticate user_dn, password
|
auth = ldap.authenticate user_dn, password
|
||||||
if !ldap.bind( auth )
|
if !ldap.bind( auth )
|
||||||
puts "NOTICE: ldap bind with '#{user_dn}' failed!"
|
Rails.logger.info "ldap bind with '#{user_dn}' failed!"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -72,10 +72,10 @@ module Auth::Ldap
|
||||||
if !user
|
if !user
|
||||||
user_attributes[:created_by_id] = 1
|
user_attributes[:created_by_id] = 1
|
||||||
user = User.create( user_attributes )
|
user = User.create( user_attributes )
|
||||||
puts "NOTICE: user created '#{user.login}'"
|
Rails.logger.debug "user created '#{user.login}'"
|
||||||
else
|
else
|
||||||
user.update_attributes( user_attributes )
|
user.update_attributes( user_attributes )
|
||||||
puts "NOTICE: user updated '#{user.login}'"
|
Rails.logger.debug "user updated '#{user.login}'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,8 @@ returns
|
||||||
# auth ok
|
# auth ok
|
||||||
if user_auth
|
if user_auth
|
||||||
|
|
||||||
|
Rails.logger.info "Authentication against #{config_item[:adapter]} for user #{user.login} ok."
|
||||||
|
|
||||||
# remember last login date
|
# remember last login date
|
||||||
user_auth.update_last_login
|
user_auth.update_last_login
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ class ActiveSupport::TestCase
|
||||||
|
|
||||||
# cleanup jobs
|
# cleanup jobs
|
||||||
def teardown
|
def teardown
|
||||||
puts 'teardown'
|
|
||||||
|
|
||||||
# check if jobs are proccessed
|
# check if jobs are proccessed
|
||||||
return if Delayed::Job.all.empty?
|
return if Delayed::Job.all.empty?
|
||||||
|
|
|
@ -509,7 +509,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
puts "hc #{human_changes.inspect}"
|
#puts "hc #{human_changes.inspect}"
|
||||||
# check changed attributes
|
# check changed attributes
|
||||||
human_changes = bg.human_changes(agent1, ticket1)
|
human_changes = bg.human_changes(agent1, ticket1)
|
||||||
assert( human_changes['Title'], 'Check if attributes translated based on ObjectManager::Attribute' )
|
assert( human_changes['Title'], 'Check if attributes translated based on ObjectManager::Attribute' )
|
||||||
|
@ -523,13 +523,13 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
assert_not( human_changes['pending_till'] )
|
assert_not( human_changes['pending_till'] )
|
||||||
|
|
||||||
human_changes = bg.human_changes(agent2, ticket1)
|
human_changes = bg.human_changes(agent2, ticket1)
|
||||||
puts "hc2 #{human_changes.inspect}"
|
#puts "hc2 #{human_changes.inspect}"
|
||||||
|
|
||||||
template = bg.template_update(agent1, ticket1, article, human_changes)
|
template = bg.template_update(agent1, ticket1, article, human_changes)
|
||||||
puts "t1 #{template.inspect}"
|
#puts "t1 #{template.inspect}"
|
||||||
|
|
||||||
template = bg.template_update(agent2, ticket1, article, human_changes)
|
template = bg.template_update(agent2, ticket1, article, human_changes)
|
||||||
puts "t2 #{template.inspect}"
|
#puts "t2 #{template.inspect}"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue