Change a user's password

@param   mixed   $user
@param   string  $password
@return  bool
160915
public static function changePassword($user = null, $password)
	{
		$passhash = self::getPasshash($password);

		return self::changePasshash($user, $passhash);
	}
397343
def change_password(ctx):
    """"""

    username, passhash = _get_credentials(ctx.obj['username'],
                                          ctx.obj['password'],
                                          ctx.obj['db'])

    change_user = ctx.obj['db'].objectmodels['user'].find_one({
        'name': username
    })
    if change_user is None:
        log('No such user', lvl=warn)
        return

    change_user.passhash = passhash
    change_user.save()

    log("Done")
1274205
public function userPassword($password = null)
    {
        if ($password === null) {
            return $this->_userPassword;
        }
        $this->_userPassword = $password;

        return $this;
    }
616764
public function changePassword(UserPassword $aPassword)
    {
        $this->password = $aPassword;
        $this->rememberPasswordToken = null;
        $this->updatedOn = new \DateTimeImmutable();
    }
751905
public function changePassword($password)
    {
        $this->password = $password;

        $this->raise(new PasswordChanged($this));

        return $this;
    }
54241
public function setPassword(\Gems_User_User $user, $password)
    {
        $data['gup_id_user']         = $user->getUserLoginId();
        $data['gup_reset_key']       = null;
        $data['gup_reset_requested'] = null;
        $data['gup_reset_required']  = 0;
        if (null === $password) {
            // Passwords may be emptied.
            $data['gup_password'] = null;
        } elseif ($this->canSaveNewHash()) {
            $data['gup_password'] = $this->hashPassword($password);
        } else {
            $data['gup_password'] = $this->hashOldPassword($password);
        }
        $data['gup_last_pwd_change'] = new \Zend_Db_Expr('CURRENT_TIMESTAMP');

        $model = new \MUtil_Model_TableModel('gems__user_passwords');
        \Gems_Model::setChangeFieldsByPrefix($model, 'gup', $user->getUserId());

        $model->save($data);

        return $this;
    }
1181990
public function setProxyAuth($user, $password)
    {
        $this->setProxyUser($user);
        $this->setProxyPassword($password);

        return $this;
    }
205072
public function login($password)
    {
        if (!$this->exists() ||
            !$this->verifyLogin($password) ||
            $this->someOneLoggedIn()
        ) {
            return false;
        }

        if ($this->lastLoginStatement === null) {
            $this->lastLoginStatement = $this->connection->prepare("UPDATE User SET lastLogin = FROM_UNIXTIME(?) WHERE username = ?");
            $this->lastLoginStatement->bindParam(1, $this->lastLogin);
            $this->lastLoginStatement->bindParam(2, $this->username);

        }
        $this->lastLogin = time();
        $this->lastLoginStatement->execute();


        $this->updateLoginSession();
        $this->notifyObservers(User::EVENT_LOGIN);
        return true;
    }
75637
def change_user_password(user, password):
    
    user.password = hash_password(password)
    _datastore.put(user)
    send_password_changed_notice(user)
    password_changed.send(current_app._get_current_object(),
                          user=user)
106509
public function withUserInfo($user, $password = null)
    {
        $this->user = $user;
        $this->password = $password;

        return $this;
    }
167817
public function actionChangePassword()
    {
        $username = $this->prompt('Username:', ['required' => true]);
        $user = $this->findModel($username);
        $user->setPassword($this->prompt('New password:', [
            'required' => true,
            'pattern' => '#^.{6,255}$#i',
            'error' => 'More than 6 symbols',
        ]));
        $this->log($this->repository->save($user));
    }
670327
public function change_password($old_password, $new_password, $username = null)
	{
		try
		{
			return (bool) $this->update_user(array('old_password' => $old_password, 'password' => $new_password), $username);
		}
		// Only catch the wrong password exception
		catch (SimpleUserWrongPassword $e)
		{
			return false;
		}
	}
1025861
public function changePassword(User $user, Request $request)
    {
        $user->password = Hash::make($request->get('password'));
        $user->save();

        Alert::info(__('User was saved'));

        return back();
    }
278505
public function setPassword($password)
    {
        $this->definition->setPassword($this, $password);
        $this->setPasswordResetRequired(false);
        $this->refresh();   // force refresh
        return $this;
    }
734355
function setPassword($password)
    {
        // TODO: maso, 2017: check password
        $salt = Pluf_Utils::getRandomString(5);
        $this->password = 'sha1:' . $salt . ':' . sha1($salt . $password);
        return true;
    }
573801
public function withUserInfo($user, $password = null)
    {
        $userInfo = implode(':', [$user, $password]);

        return $this->_clone('userInfo', rtrim($userInfo, ':'));
    }
131707
public function deleteUser(User $user, string $password) : bool {
		if ($user->doesPasswordMatch($password)) {
			$stmt = $this->db->prepare(
				"DELETE FROM accounts " .
				"WHERE id=? AND username=? AND email=?;"
			);
			$stmt->bind_param("iss",
				$user->id, $user->username, $user->email);
			$stmt->execute();
			$this->db->commit();
			return true;
		} else {
			return false;
		}
	}