Method: Origen::Users::User#password
- Defined in:
- lib/origen/users/user.rb
#password(options = {}) ⇒ Object
Returns the password for the current user. If the user hasn’t supplied it yet they will be prompted to enter it, it will then be stored
First, try in the global session, if its not defined, ask for it.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/origen/users/user.rb', line 185 def password( = {}) unless current? fail "You can only reference the password for the current user (#{self.class.current_user_id})!" end if [:refresh] auth_session[:password] = nil end if auth_session[:password] password = decrypt(auth_session[:password]) else puts 'Please enter your password:' password = (STDIN.noecho(&:gets) || '').chomp # TODO: Need some kind of callback here to optionally verify password correctness via LDAP or similar auth_session[:password] = encrypt(password) end password end |