internal.rb 512 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. class Auth
  3. class Internal < Auth::Base
  4. def valid?(user, password)
  5. return false if user.blank?
  6. if PasswordHash.legacy?(user.password, password)
  7. update_password(user, password)
  8. return true
  9. end
  10. PasswordHash.verified?(user.password, password)
  11. end
  12. private
  13. def update_password(user, password)
  14. user.password = PasswordHash.crypt(password)
  15. user.save
  16. end
  17. end
  18. end