Set the maximum number of days during which a password is valid. See man
    passwd.

    CLI Example:

    .. code-block:: bash

        salt '*' shadow.set_maxdays username 90
768128
def set_maxdays(name, maxdays):
    '''
    
    '''
    pre_info = info(name)
    if maxdays == pre_info['max']:
        return True
    cmd = 'passwd -x {0} {1}'.format(maxdays, name)
    __salt__['cmd.run'](cmd, python_shell=False)
    post_info = info(name)
    if post_info['max'] != pre_info['max']:
        return post_info['max'] == maxdays
413233
private function setDay($day) {
        
        //preventing duplication process
        if ($day == $this->day) {
            return;
        }
        $maximumDayOfMonth = static::getMonthLength($this->month, $this->year);
        $dayToSet          = $day;
        if ($dayToSet < 1) {
            
            $dayToSet = abs($dayToSet);
            
            while ($dayToSet > $maximumDayOfMonth) {
                $dayToSet -= $maximumDayOfMonth;
                $month    = $this->month - 1;
                $this->setMonth($month);
                $maximumDayOfMonth = static::getMonthLength($this->month, $this->year);
            }
            
            $dayToSet = $maximumDayOfMonth - $dayToSet;
            $month    = $this->month - 1;
            $this->setMonth($month);
            
        } elseif ($dayToSet > $maximumDayOfMonth) {
            while ($dayToSet > $maximumDayOfMonth) {
                $dayToSet -= $maximumDayOfMonth;
                $month    = $this->month + 1;
                $this->setMonth($month);
                $maximumDayOfMonth = static::getMonthLength($this->month, $this->year);
            }
        }
        
        $this->day = (int) $dayToSet;
    }
279772
def set_user_passwd(self, userid, data):
        """"""
        return self.api_call(
            ENDPOINTS['users']['password'],
            dict(userid=userid),
            body=data)
677145
def _password(self, password):
        
        with self.lock:
            self.send('PASS :%s' % password, error_check=True)
865617
def main():
    
    parser = argparse.ArgumentParser(
        description="Generate random password."
    )
    parser.add_argument("-l", "--length",
                        help="the length of the generated "
                             "password (default: 12)",
                        type=int, default=12)
    parser.add_argument("-n", "--number",
                        help="how many passwords to generate (default: 10)",
                        type=int, default=10)
    parser.add_argument("-p", "--punctuation",
                        help="use punctuation characters",
                        action='store_true')
    parser.add_argument("--limit-punctuation",
                        help="specify allowed punctuation characters",
                        action='store', default='')
    alnum_group = parser.add_mutually_exclusive_group()
    alnum_group.add_argument("--no-digits",
                             help="don't use digits",
                             action='store_false', dest='digits')
    alnum_group.add_argument("--no-letters",
                             help="don't use letters",
                             action='store_false', dest='letters')
    case_group = parser.add_mutually_exclusive_group()
    case_group.add_argument("--upper",
                            help="use only upper case letters",
                            action='store_true')
    case_group.add_argument("--lower",
                            help="use only lower case letters",
                            action='store_true')
    args = parser.parse_args()

    if args.length < 1:
        _error("argument -l/--length must be greater than zero")
    if args.number < 1:
        _error("argument -n/--number must be greater than zero")

    if args.lower:
        case = "lower"
    elif args.upper:
        case = "upper"
    else:
        case = "both"

    for _ in range(args.number):
        print(passgen(args.length, punctuation=args.punctuation,
                      limit_punctuation=args.limit_punctuation,
                      digits=args.digits,
                      letters=args.letters, case=case))
731403
def set_password(self, user, password):
        
        url = self._build_url(self.endpoint.set_password(id=user))
        return self._post(url, payload=dict(password=password))
353163
def set_password(self, password, encryptAlgo='MD5'):
		
		if not password:
			self.info['encryptionAlgorithmID'] = None
			self.info['keyHashAlgorithm'] = None
			return

		self.password = gntp.shim.b(password)
		self.encryptAlgo = encryptAlgo.upper()

		if not self.encryptAlgo in self.hash_algo:
			raise errors.UnsupportedError('INVALID HASH "%s"' % self.encryptAlgo)

		hashfunction = self.hash_algo.get(self.encryptAlgo)

		password = password.encode('utf8')
		seed = time.ctime().encode('utf8')
		salt = hashfunction(seed).hexdigest()
		saltHash = hashfunction(seed).digest()
		keyBasis = password + saltHash
		key = hashfunction(keyBasis).digest()
		keyHash = hashfunction(key).hexdigest()

		self.info['keyHashAlgorithmID'] = self.encryptAlgo
		self.info['keyHash'] = keyHash.upper()
		self.info['salt'] = salt.upper()
930196
def pw(min_word_length=3, max_word_length=8, max_int_value=1000, number_of_elements=4, no_special_characters=False):
    

    # Set the position of the integer
    int_position = set_int_position(number_of_elements)

    # Load dictionary
    dictionary = load_dictionary()

    password = ''
    for i in range(number_of_elements):
        # Add word or integer
        if i == int_position:
            password += str(get_random_int(max_int_value))
        else:
            password += get_random_word(dictionary,
                                        min_word_length,
                                        max_word_length).title()

        # Add separator
        if i != number_of_elements - 1:
            password += get_random_separator(no_special_characters)

    return password
305838
def set_slimits(self, min, max):
        
        self.limits['smin'] = sqrt(min)
        self.limits['smax'] = sqrt(max)
306269
def set_password(self, password):
        
        self.password = password
        self.changed_event.emit(self)
995345
def bcrypt_set_password(self, raw_password):
    
    if not is_enabled() or raw_password is None:
        _set_password(self, raw_password)
    else:
        salt = bcrypt.gensalt(get_rounds())
        self.password = 'bc$' + bcrypt.hashpw(smart_str(raw_password), salt)
6707
def set_basic_auth(self, username, password, realm):
    
    self._passmgr.add_password(realm, self._base_url, username, password)
    return self
855015
def update_limit(self, days, kind=2, condition='>='):
        
        url = 'http://www.shanbay.com/team/setqualification/%s' % self.team_id
        data = {
            'kind': kind,
            'condition': condition,
            'value': days,
            'team': self.team_id,
            'csrfmiddlewaretoken': self._request.cookies.get('csrftoken')
        }
        r = self.request(url, 'post', data=data)
        return r.url == 'http://www.shanbay.com/referral/invite/?kind=team'
432560
def set_password(self, service, username, password):
        
        service = self._safe_string(service)
        username = self._safe_string(username)
        password = self._safe_string(password)
        attrs = GnomeKeyring.Attribute.list_new()
        GnomeKeyring.Attribute.list_append_string(attrs, 'username', username)
        GnomeKeyring.Attribute.list_append_string(attrs, 'service', service)
        GnomeKeyring.Attribute.list_append_string(
            attrs, 'application', 'python-keyring')
        result = GnomeKeyring.item_create_sync(
            self.keyring_name, GnomeKeyring.ItemType.NETWORK_PASSWORD,
            "Password for '%s' on '%s'" % (username, service),
            attrs, password, True)[0]
        if result == GnomeKeyring.Result.CANCELLED:
            # The user pressed "Cancel" when prompted to unlock their keyring.
            raise PasswordSetError("Cancelled by user")
        elif result != GnomeKeyring.Result.OK:
            raise PasswordSetError(result.value_name)
416213
def set_password(self, raw_password):
        
        if raw_password is None:
            self.set_unusable_password()
        else:
            xmpp_backend.set_password(self.node, self.domain, raw_password)
838702
def update_time_reset_passwd(user_name, the_time):
        '''
        
        '''
        entry = TabMember.update(
            time_reset_passwd=the_time,
        ).where(TabMember.user_name == user_name)
        try:
            entry.execute()
            return True
        except:
            return False
856011
def expirePassword(self,
                       hours="now"):
        """"""

        params = {
            "f" : "json"
        }
        expiration = -1
        if isinstance(hours, str):
            if expiration == "now":
                expiration = -1
            elif expiration == "never":
                expiration = 0
            else:
                expiration = -1
        elif isinstance(expiration, (int, long)):
            dt = datetime.now() + timedelta(hours=hours)
            expiration = local_time_to_online(dt=dt)
        else:
            expiration = -1
        params['expiration'] = expiration
        url = "%s/expirePassword" % self.root
        return self._post(url=url,
                             param_dict=params,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url,
                             proxy_port=self._proxy_port)