mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
21 lines
500 B
Ruby
21 lines
500 B
Ruby
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
module Auth::Internal
|
|
def self.check(username, password, _config, user)
|
|
|
|
# return if no user exists
|
|
return false if !username
|
|
return false if !user
|
|
|
|
# sha auth check
|
|
if user.password =~ /^\{sha2\}/
|
|
crypted = Digest::SHA2.hexdigest(password)
|
|
return user if user.password == "{sha2}#{crypted}"
|
|
end
|
|
|
|
# plain auth check
|
|
return user if user.password == password
|
|
|
|
false
|
|
end
|
|
end
|