class CopDetectiveValidator

Public Class Methods

new_passwords_match?(password, confirmation) click to toggle source
# File lib/validator.rb, line 26
def new_passwords_match?(password, confirmation)
  password == confirmation
end
valid_credentials?(user, old_password) click to toggle source
# File lib/validator.rb, line 22
def valid_credentials?(user, old_password)
  user.authenticate(old_password) == user
end
validate_new_passwords(user, password, confirmation) click to toggle source
# File lib/validator.rb, line 13
def validate_new_passwords(user, password, confirmation)
  if new_passwords_match?(password, confirmation)
    user.password = password
    @@messages[:notice] = "Password updated"
  else
    user.errors.full_messages << CopDetective::ErrorMessages.unsaved_password(CopDetective::ErrorMessages.non_matching)
  end
end