Skip to content

Commit

Permalink
Merge pull request #180 from rapid7/password-policy-expiration
Browse files Browse the repository at this point in the history
Password policy expiration
  • Loading branch information
gschneider-r7 committed Jul 16, 2015
2 parents 4baa737 + d37f584 commit 97358eb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/nexpose/password_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ class PasswordPolicy < APIObject
attr_accessor :capitals
attr_accessor :digits
attr_accessor :special_chars
attr_accessor :expiration_days

def initialize(policy_name:, min_length:, max_length:, special_chars:, capitals:, digits:)
def initialize(policy_name:, min_length:, max_length:, special_chars:, capitals:, digits:, expiration_days: 0)
@policy_name = policy_name.to_s
@min_length = min_length.to_i
@max_length = max_length.to_i
@special_chars = special_chars.to_i
@capitals = capitals.to_i
@digits = digits.to_i
@expiration_days = expiration_days.to_i
end

def self.from_hash(hash)
Expand All @@ -24,7 +26,8 @@ def self.from_hash(hash)
max_length: hash[:maxLength],
special_chars: hash[:specialChars],
capitals: hash[:capitals],
digits: hash[:digits])
digits: hash[:digits],
expiration_days: hash[:expirationDays])
end

def to_h
Expand All @@ -34,7 +37,8 @@ def to_h
maxLength: @max_length,
specialChars: @special_chars,
capitals: @capitals,
digits: @digits
digits: @digits,
expirationDays: @expiration_days
}
end

Expand Down

0 comments on commit 97358eb

Please sign in to comment.