1234567891011121314151617181920 |
- # 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 nil 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
- return false
- end
- end
|