Securely and interactively ask for a password
973163
def _ask_password():
    """"""

    password = "Foo"
    password_trial = ""

    while password != password_trial:
        password = getpass.getpass()
        password_trial = getpass.getpass(prompt="Repeat:")
        if password != password_trial:
            print("\nPasswords do not match!")

    return password
808999
def check_auth(self, username, password):
        """"""
        if username == self.args.username:
            from glances.password import GlancesPassword
            pwd = GlancesPassword()
            return pwd.check_password(self.args.password, pwd.sha256_hash(password))
        else:
            return False
1092872
def make_password(length, chars=string.letters + string.digits + '#$%&!'):
    
    return get_random_string(length, chars)
1034197
function askForAdminPassword() {
    if (this.regenerate || this.serviceDiscoveryType !== 'eureka') return;

    const done = this.async();

    const prompts = [
        {
            type: 'input',
            name: 'adminPassword',
            message: 'Enter the admin password used to secure the JHipster Registry',
            default: 'admin',
            validate: input => (input.length < 5 ? 'The password must have at least 5 characters' : true)
        }
    ];

    this.prompt(prompts).then(props => {
        this.adminPassword = props.adminPassword;
        this.adminPasswordBase64 = getBase64Secret(this.adminPassword);
        done();
    });
}
431005
def auth_pair(self, force_console=False):
        """"""
        if not self.auth_valid():
            self._get_auth(force_console)
        return (self.user, self.password)
126816
function prompForPassword(done) {
  inquirer.prompt([
    {
      type: 'password',
      message: 'Enter the password',
      name: 'password',
      validate(input) {
        return input.length > 0;
      }
    }
  ], answers => {
    done(answers.password);
  });
}
167073
def secure_password(length=20, use_random=True):
    '''
    
    '''
    try:
        length = int(length)
        pw = ''
        while len(pw) < length:
            if HAS_RANDOM and use_random:
                while True:
                    try:
                        char = salt.utils.stringutils.to_str(get_random_bytes(1))
                        break
                    except UnicodeDecodeError:
                        continue
                pw += re.sub(
                    salt.utils.stringutils.to_str(r'\W'),
                    str(),  # future lint: disable=blacklisted-function
                    char
                )
            else:
                pw += random.SystemRandom().choice(string.ascii_letters + string.digits)
        return pw
    except Exception as exc:
        log.exception('Failed to generate secure passsword')
        raise CommandExecutionError(six.text_type(exc))
567855
def get_password(args):
    
    password = ''

    if args.__dict__.get('password'):
        # Specify password as argument (for -p option)
        password = args.password

    elif args.__dict__.get('P'):
        # Enter password interactively (for -P option)
        while True:
            # When setting password in $HOME/.tdclirc, using it.
            if password:
                break

            else:
                # Not set in $HOME/.tdclirc, attempt input prompt
                from getpass import getpass
                password = getpass(prompt='TonicDNS user password: ')

    return password
750857
def a_send_password(password, ctx):
    
    if password:
        ctx.ctrl.send_command(password, password=True)
        return True
    else:
        ctx.ctrl.disconnect()
        raise ConnectionAuthenticationError("Password not provided", ctx.ctrl.hostname)
387536
def secretly(reactor, action, system=None, username=None,
             prompt="Password:"):
    
    if system is None:
        system = action.__module__
        if system == '__main__':
            system = os.path.abspath(sys.argv[0])
    if username is None:
        username = getpass.getuser()
    while True:
        secret = keyring.get_password(system, username)
        if secret is not None:
            break
        pinentry = yield choosePinentry()
        keyring.set_password(
            system, username,
            (yield pinentry.askForPassword(
                reactor, prompt, "Enter Password",
                "Password Prompt for {username}@{system}"
                .format(system=system, username=username)))
        )
    yield maybeDeferred(action, secret)
273291
def _get_client_and_key(url, user, password, verbose=0):
    '''
    
    '''
    session = {}
    session['client'] = six.moves.xmlrpc_client.Server(url, verbose=verbose, use_datetime=True)
    session['key'] = session['client'].auth.login(user, password)

    return session
29211
def load_password(self):
        """"""
        # Read the password file, if it exists
        with open(self.password_file, 'r') as file_pwd:
            hashed_password = file_pwd.read()

        return hashed_password
1251017
def acquire_password(args)
      if args[:pw] == :prompt
        JSS.prompt_for_password "Enter the password for JSS user #{args[:user]}@#{args[:server]}:"
      elsif args[:pw].is_a?(Symbol) && args[:pw].to_s.start_with?('stdin')
        args[:pw].to_s =~ /^stdin(\d+)$/
        line = Regexp.last_match(1)
        line ||= 1
        JSS.stdin line
      else
        args[:pw]
      end
    end
306269
def set_password(self, password):
        
        self.password = password
        self.changed_event.emit(self)
677145
def _password(self, password):
        
        with self.lock:
            self.send('PASS :%s' % password, error_check=True)
37669
def unlock(self, password, auth_no_user_interaction=None):
        """"""
        return self._M.Encrypted.Unlock(
            '(sa{sv})',
            password,
            filter_opt({
                'auth.no_user_interaction': ('b', auth_no_user_interaction),
            })
        )
78789
def get_password(vm_):
    
    '''
    return config.get_cloud_config_value(
        'password', vm_, __opts__,
        default=config.get_cloud_config_value(
            'passwd', vm_, __opts__,
            search_global=False
        ),
        search_global=False
    )