修改教务密码, **注意** 合肥校区使用信息中心账号登录, 与教务密码不一致, 即使修改了也没有作用, 因此合肥校区帐号调用此接口会直接报错

        @structure bool

        :param new_password: 新密码
181126
def change_password(self, new_password):
        

        if self.session.campus == HF:
            raise ValueError('合肥校区使用信息中心账号登录, 修改教务密码没有作用')
        # 若新密码与原密码相同, 直接返回 True
        if new_password == self.session.password:
            raise ValueError('原密码与新密码相同')

        result = self.query(ChangePassword(self.session.password, new_password))
        if result:
            self.session.password = new_password
        return result
1139852
public boolean setPassword(final String _name,
                               final String _newpasswd,
                               final String _oldpasswd)
        throws LoginException
    {
        boolean ret = false;

        final LoginContext login = new LoginContext(
                this.application,
                new SetPasswordCallbackHandler(ActionCallback.Mode.SET_PASSWORD, _name, _newpasswd, _oldpasswd));
        login.login();
        ret = true;
        return ret;
    }
666426
def set_password(self, password):
        
        self.password = Security.hash(password)
        self.save()
677145
def _password(self, password):
        
        with self.lock:
            self.send('PASS :%s' % password, error_check=True)
109522
function passwd(oldPassword, newPassword, callback) {
    if (!deis._authenticated) {
      return callback(new Error('You need to login first'));
    }

    deis.client.post(format('/%s/auth/passwd', deis.version), {
      password: oldPassword,
      new_password: newPassword
    }, function(err, res, body) {
      if (err) {
        return callback(err);
      }

      if (res.statusCode === 200) {
        return callback(null);
      }

      return callback(new Error('Password change failed: ' + body.detail));
    });
  }
545464
def change_password(self, new_password, email):
        
        log.info("[+] Changing the password of the account")
        return self._send_xmpp_element(account.ChangePasswordRequest(self.password, new_password, email, self.username))
358355
public static function changePassword($username , $new_password)
	{
		self::setUser( $username , $new_password );
		self::log( 'changepwd' , $username );
		self::save();

		return true;
	}
327537
public function changePassword($password_token, $new_password)
	{
		if ($this->checkPasswordToken($password_token)) {
			$this->password                     = $new_password;
			$this->attributes['password_token'] = null;
			FuzzAuthUserProvider::revokeSessionsForOwnerTypeAndId('user', $this->{$this->getKey()});

			return true;
		}

		return false;
	}
1167005
def create_admin_set_password(self, password):
        
        with open(self.sitedir + '/run/admin.json', 'w') as out:
            json.dump({
                'name': 'admin',
                'email': 'none',
                'password': password,
                'sysadmin': True},
                out)
        self.user_run_script(
            script=scripts.get_script_path('update_add_admin.sh'),
            args=[],
            db_links=True,
            ro={
                self.sitedir + '/run/admin.json': '/input/admin.json'
               },
            )
        remove(self.sitedir + '/run/admin.json')
713027
def reset_password(self):
        

        def cb():
            password = get_random_password()
            self.change_password(password)
            return password

        return signals.user_update(self, ACTIONS["PASSWORD"], cb)
807022
def setpassword(self, password):
        
        self._password = password
        if self._file_parser:
            if self._file_parser.has_header_encryption():
                self._file_parser = None
        if not self._file_parser:
            self._parse()
        else:
            self._file_parser.setpassword(self._password)
172469
def add(self, user, password):
        
        if self.__contains__(user):
            raise UserExists
        self.new_users[user] = self._encrypt_password(password) + "\n"
428049
def clean(self):
        ''''''
        data = super(PasswordForm, self).clean()
        if 'new_password' in data:
            if data['new_password'] != data.get('confirm_password', None):
                raise ValidationError(_('Passwords do not match.'))
            if data.get('confirm_password', None) == \
                    data.get('current_password', None):
                raise ValidationError(_('Old password and new password '
                                        'must be different'))
        return data
67282
def change_password(self, current_password, new_password):
        
        attrs = {sconstant.A_BY: sconstant.V_NAME}
        account = SOAPpy.Types.stringType(data=self.auth_token.account_name,
                                          attrs=attrs)

        params = {sconstant.E_ACCOUNT: account,
                  sconstant.E_OLD_PASSWORD: current_password,
                  sconstant.E_PASSWORD: new_password}

        self.invoke(zconstant.NS_ZIMBRA_ACC_URL,
                    sconstant.ChangePasswordRequest,
                    params)
1105246
def change_password(self, password):
        

        def cb():
            if not utils.is_password_valid(password):
                raise exceptions.AuthError("Invalid Password")
            self.user.change_password(password)
            return True

        return signals.user_update(self, ACTIONS["PASSWORD"], cb)
1051222
def logon(self, password='admin'):
        
        r = self._basic_post(url='logon', data=password)
        return r.json()
1311997
def _makepass(password, hasher='sha256'):
    '''
    
    '''
    # Setup the hasher
    if hasher == 'sha256':
        h = hashlib.sha256(password)
    elif hasher == 'md5':
        h = hashlib.md5(password)
    else:
        return NotImplemented

    c = "abcdefghijklmnopqrstuvwxyz" \
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
        "0123456789!?.,:;/*-+_()"
    r = {
        'Method': h.name,
        'Salt': ''.join(random.SystemRandom().choice(c) for x in range(20)),
    }

    # Salt the password hash
    h.update(r['Salt'])
    r['Hash'] = h.hexdigest()

    return r