Class: Miam::PasswordManager
- Inherits:
-
Object
- Object
- Miam::PasswordManager
- Includes:
- Logger::Helper
- Defined in:
- lib/miam/password_manager.rb
Constant Summary collapse
- LOWERCASES =
('a'..'z').to_a
- UPPERCASES =
('A'..'Z').to_a
- NUMBERS =
('0'..'9').to_a
- SYMBOLS =
"!@\#$%^&*()_+-=[]{}|'".split(//)
Instance Method Summary collapse
- #identify(user, type, policy) ⇒ Object
-
#initialize(output, options = {}) ⇒ PasswordManager
constructor
A new instance of PasswordManager.
- #puts_password(user, type, password) ⇒ Object
Methods included from Logger::Helper
Constructor Details
#initialize(output, options = {}) ⇒ PasswordManager
Returns a new instance of PasswordManager.
9 10 11 12 |
# File 'lib/miam/password_manager.rb', line 9 def initialize(output, = {}) @output = output @options = end |
Instance Method Details
#identify(user, type, policy) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/miam/password_manager.rb', line 14 def identify(user, type, policy) password = mkpasswd(policy) log(:debug, "mkpasswd: #{password}") puts_password(user, type, password) password end |
#puts_password(user, type, password) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/miam/password_manager.rb', line 21 def puts_password(user, type, password) log(:info, "User `#{user}` > `#{type}`: put password to `#{@output}`") open_output do |f| f.puts("#{user},#{type},#{password}") end end |