Sha256: 51c10b41d7eb7546058e7ca1dcfce8e98b463c522923efab339b958518a2f393

Contents?: true

Size: 618 Bytes

Versions: 20

Compression:

Stored size: 618 Bytes

Contents

# :nodoc: namespace
module Authpwn

# Common code for credentials that expire.
module Expires
  extend ActiveSupport::Concern

  included do
    # Number of seconds after which a credential becomes unusable.
    #
    # Users can reset this timer by updating their credentials, e.g. changing
    # their password.
    class_attribute :expires_after, instance_writer: false
  end

  # True if this password is too old and should not be used for authentication.
  def expired?
    return false unless expires_after
    updated_at < Time.now - expires_after
  end
end  # module Authpwn::Expires

end  # namespace Authpwn

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
authpwn_rails-0.21.0 lib/authpwn_rails/expires.rb
authpwn_rails-0.20.0 lib/authpwn_rails/expires.rb
authpwn_rails-0.19.0 lib/authpwn_rails/expires.rb
authpwn_rails-0.18.2 lib/authpwn_rails/expires.rb
authpwn_rails-0.18.1 lib/authpwn_rails/expires.rb
authpwn_rails-0.18.0 lib/authpwn_rails/expires.rb
authpwn_rails-0.17.2 lib/authpwn_rails/expires.rb
authpwn_rails-0.17.1 lib/authpwn_rails/expires.rb
authpwn_rails-0.17.0 lib/authpwn_rails/expires.rb
authpwn_rails-0.16.2 lib/authpwn_rails/expires.rb
authpwn_rails-0.16.1 lib/authpwn_rails/expires.rb
authpwn_rails-0.16.0 lib/authpwn_rails/expires.rb
authpwn_rails-0.15.3 lib/authpwn_rails/expires.rb
authpwn_rails-0.15.2 lib/authpwn_rails/expires.rb
authpwn_rails-0.15.1 lib/authpwn_rails/expires.rb
authpwn_rails-0.15.0 lib/authpwn_rails/expires.rb
authpwn_rails-0.14.3 lib/authpwn_rails/expires.rb
authpwn_rails-0.14.2 lib/authpwn_rails/expires.rb
authpwn_rails-0.14.1 lib/authpwn_rails/expires.rb
authpwn_rails-0.14.0 lib/authpwn_rails/expires.rb