Sha256: 431e6266dced0d351306a8aa572f015138dd4b843355bd4e65f60f30d27499f5

Contents?: true

Size: 622 Bytes

Versions: 4

Compression:

Stored size: 622 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.current - expires_after
  end
end  # module Authpwn::Expires

end  # namespace Authpwn

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authpwn_rails-0.23.0 lib/authpwn_rails/expires.rb
authpwn_rails-0.22.1 lib/authpwn_rails/expires.rb
authpwn_rails-0.22.0 lib/authpwn_rails/expires.rb
authpwn_rails-0.21.1 lib/authpwn_rails/expires.rb