app/models/credentials/password.rb in authpwn_rails-0.13.4 vs app/models/credentials/password.rb in authpwn_rails-0.14.0

- old
+ new

@@ -3,18 +3,18 @@ # Associates a password with the user account. class Password < ::Credential # Virtual attribute: the user's password. attr_accessor :password - validates :password, :presence => { :on => :create }, - :confirmation => { :allow_nil => true } + validates :password, presence: { on: :create }, + confirmation: { allow_nil: true } # Virtual attribute: confirmation for the user's password. attr_accessor :password_confirmation # A user can have a single password. - validates :user_id, :uniqueness => true + validates :user_id, uniqueness: true # Passwords can expire, if users don't change them often enough. include Authpwn::Expires # Passwords don't expire by default, because it is non-trivial to get e-mail # delivery working in Rails, which is necessary for recovering from expired @@ -71,10 +71,12 @@ # Generates a random salt value. def self.random_salt [(0...12).map { |i| 1 + rand(255) }.pack('C*')].pack('m').strip end - # Forms can only change the plain-text password fields. - attr_accessible :password, :password_confirmation + if ActiveRecord::Base.respond_to? :mass_assignment_sanitizer= + # Forms can only change the plain-text password fields. + attr_accessible :password, :password_confirmation + end end # class Credentials::Password end # namespace Credentials