Improved error handling.
This commit is contained in:
parent
7f7312129c
commit
d2b1e69326
4 changed files with 15 additions and 16 deletions
|
@ -1,16 +1,14 @@
|
|||
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module Auth::Developer
|
||||
def self.check( _username, password, _config, user )
|
||||
def self.check(username, password, _config, user)
|
||||
|
||||
# development systems
|
||||
if Setting.get('developer_mode') == true
|
||||
if password == 'test'
|
||||
return false if !username
|
||||
return false if !user
|
||||
return false if Setting.get('developer_mode') != true
|
||||
return false if password != 'test'
|
||||
Rails.logger.info "System in developer mode, authentication for user #{user.login} ok."
|
||||
return user
|
||||
end
|
||||
end
|
||||
|
||||
false
|
||||
user
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module Auth::Internal
|
||||
def self.check( _username, password, _config, user )
|
||||
def self.check(username, password, _config, user)
|
||||
|
||||
# return if no user exists
|
||||
return nil if !user
|
||||
return false if !username
|
||||
return false if !user
|
||||
|
||||
# sha auth check
|
||||
if user.password =~ /^\{sha2\}/
|
||||
|
|
Loading…
Reference in a new issue