module Devise::Models::Validatable

def password_required?

or confirmation are being set somewhere.
Passwords are always required if it's a new record, or if the password
Checks whether a password is needed or not. For validations only.
def password_required?
  !persisted? || !password.nil? || !password_confirmation.nil?
end