internal.rb 500 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. module Auth::Internal
  3. def self.check(username, password, _config, user)
  4. # return if no user exists
  5. return false if !username
  6. return false if !user
  7. # sha auth check
  8. if user.password =~ /^\{sha2\}/
  9. crypted = Digest::SHA2.hexdigest(password)
  10. return user if user.password == "{sha2}#{crypted}"
  11. end
  12. # plain auth check
  13. return user if user.password == password
  14. false
  15. end
  16. end