Updates default admin user login name and password

@param string $sLoginName admin user login name
@param string $sPassword  admin user login password
339705
public function writeAdminLoginData($sLoginName, $sPassword)
    {
        $sPassSalt = $this->getInstance("Utilities")->generateUID();

        $sPassword = hash('sha512', $sPassword . $sPassSalt);

        $sQ = "update oxuser set oxusername='{$sLoginName}', oxpassword='{$sPassword}', oxpasssalt='{$sPassSalt}' where OXUSERNAME='admin'";
        $this->execSql($sQ);

        $sQ = "update oxnewssubscribed set oxemail='{$sLoginName}' where OXEMAIL='admin'";
        $this->execSql($sQ);
    }
1274488
public function verifyCredentials($sIdentifier, $sPassword)
    {
        //  Look up the user, how we do so depends on the login mode that the app is using
        $oUserModel     = Factory::model('User', 'nails/module-auth');
        $oPasswordModel = Factory::model('UserPassword', 'nails/module-auth');
        $oUser          = $oUserModel->getByIdentifier($sIdentifier);

        return !empty($oUser) ? $oPasswordModel->isCorrect($oUser->id, $sPassword) : false;
    }
1184856
public function create_user($email, $name, $mention_name = null,
                              $title = null, $is_group_admin = 0,
                              $password = null, $timezone = null) {
    $args = array(
      'email' => $email,
      'name'  => $name,
    );

    if ($mention_name) {
      $args['mention_name'] = $mention_name;
    }

    if ($title) {
      $args['title'] = $title;
    }

    if ($is_group_admin) {
      $args['is_group_admin'] = (int)$is_group_admin;
    }

    if ($password) {
      $args['password'] = $password;
    }

    // @see http://api.hipchat.com/docs/api/timezones
    if ($timezone) {
      $args['timezone'] = $timezone;
    }

    // Return the std object
    return $this->make_request('users/create', $args, 'POST');
  }
1226586
public function loadByLoginName(string $login_name): ?UserInterface
    {
        if(array_key_exists($login_name, $this->users)){
            return $this->convertUser($this->users[$login_name]);
        }

        return null;
    }
1159829
public function changeFtpPassword($domain, $ftpUserName, $password)
    {
        return $this->send('v-change-web-domain-ftp-password', $this->userName, $domain, $ftpUserName,
            $password);
    }
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')
853870
def get_sudoers_entry(username=None, sudoers_entries=None):
    
    for entry in sudoers_entries:
        if entry.startswith(username):
            return entry.replace(username, '').strip()
392736
public function updateUser(User $user, $name, $emailAddress, $password = null, $isAdmin = null)
    {
        $user->setName($name);
        $user->setEmail($emailAddress);

        if (!empty($password)) {
            $user->setHash(password_hash($password, PASSWORD_DEFAULT));
        }

        if (!is_null($isAdmin)) {
            $user->setIsAdmin(($isAdmin ? 1 : 0));
        }

        return $this->store->save($user);
    }
299614
public function actionUserNameToFirstName()
    {
        if (!CmsUser::find()->count()) {
            $this->stdout("Content not found!\n", Console::BOLD);
            return;
        }

        $this->stdout("1. Cms user name normalize!\n", Console::FG_YELLOW);

        /**
         * @var CmsUser $cmsUser
         */
        foreach (CmsUser::find()->orderBy(['id' => SORT_ASC])->each(10) as $cmsUser) {
            $this->stdout("\t User: {$cmsUser->id}\n", Console::FG_YELLOW);

            if (!$cmsUser->_to_del_name) {
                $this->stdout("\t NOT found property: _to_del_name\n", Console::FG_YELLOW);
                continue;
            }

            $name = $cmsUser->_to_del_name;
            $nameData = explode(" ", $name);

            if (isset($nameData[0])) {
                $cmsUser->first_name = trim($nameData[0]);
            }

            if (isset($nameData[1])) {
                $cmsUser->last_name = trim($nameData[1]);
            }

            if (isset($nameData[2])) {
                $cmsUser->patronymic = trim($nameData[2]);
            }


            if ($cmsUser->save()) {
                $this->stdout("\t Updated name: {$cmsUser->name}\n", Console::FG_GREEN);
            } else {
                $this->stdout("\t NOT updated name: {$cmsUser->id}\n", Console::FG_RED);
            }
        }
    }
874171
def update_cluster_admin_password(self, username, new_password):
        """"""
        url = "cluster_admins/{0}".format(username)

        data = {
            'password': new_password
        }

        self.request(
            url=url,
            method='POST',
            data=data,
            expected_response_code=200
        )

        return True
752118
public function setDefaultUser(ConsoleCommandEvent $event)
    {
        $command = $event->getCommand();

        if ($command instanceof AdminCliCommand) {
            $user = $this->userManager->getDefaultClarolineAdmin();
            $token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
            $this->tokenStorage->setToken($token);
        }
    }
886001
public function setRememberCookie($iId = null, $sPassword = null, $sEmail = null)
    {
        //  Is remember me functionality enabled?
        $oConfig = Factory::service('Config');
        $oConfig->load('auth/auth');

        if (!$oConfig->item('authEnableRememberMe')) {
            return false;
        }

        // --------------------------------------------------------------------------

        if (empty($iId) || empty($sPassword) || empty($sEmail)) {

            if (!activeUser('id') || !activeUser('password') || !activeUser('email')) {

                return false;

            } else {
                $iId       = $this->activeUser('id');
                $sPassword = $this->activeUser('password');
                $sEmail    = $this->activeUser('email');
            }
        }

        // --------------------------------------------------------------------------

        //  Generate a code to remember the user by and save it to the DB
        $oEncrypt = Factory::service('Encrypt');
        $sSalt    = $oEncrypt->encode(sha1($iId . $sPassword . $sEmail . APP_PRIVATE_KEY . time()));

        $oDb = Factory::service('Database');
        $oDb->set('remember_code', $sSalt);
        $oDb->where('id', $iId);
        $oDb->update($this->table);

        // --------------------------------------------------------------------------

        //  Set the cookie
        set_cookie([
            'name'   => $this->sRememberCookie,
            'value'  => $sEmail . '|' . $sSalt,
            'expire' => 1209600, //   2 weeks
        ]);

        // --------------------------------------------------------------------------

        //  Update the flag
        $this->bIsRemembered = true;

        return true;
    }
1171273
public function editUserPassword($user_name, $new_password)
    {
        $url          = $this->url.'users/'.$user_name.'/password';
        $option       = [
            'newpassword' => $password
        ];
        $access_token = $this->getToken();
        $header []    = 'Authorization: Bearer '.$access_token;

        return Http::postCurl($url, $option, $header, 'PUT');
    }
317636
public function addUser(string $login_name, string $login_password, array $roles = []) : self
    {
        $this->users[$login_name]   = [
            'login_name'            => $login_name,
            'login_password'        => $login_password,
            'roles'                 => $roles,
        ];

        return $this;
    }
921927
public static function setDefaultAdmin($username, $password)
    {
        // don't overwrite if already set
        if (static::hasDefaultAdmin()) {
            throw new BadMethodCallException(
                "Default admin already exists. Use clearDefaultAdmin() first."
            );
        }

        if (empty($username) || empty($password)) {
            throw new InvalidArgumentException("Default admin username / password cannot be empty");
        }

        static::$default_username = $username;
        static::$default_password = $password;
        static::$has_default_admin = true;
    }
446205
private function _add_user_verify_name($addname) {
		$logger = $this->logger;

		# check name, allow multi-byte chars but not whitespace
		if (strlen($addname) > 64) {
			# max 64 chars
			$logger->warning(
				"Zapmin: usradd: name invalid: '$addname'.");
			return AdminStoreError::USERNAME_TOO_LONG;
		}
		foreach([" ", "\n", "\r", "\t"] as $white) {
			# never allow whitespace in the middle
			if (strpos($addname, $white) !== false) {
				$logger->warning(
					"Zapmin: usradd: name invalid: '$addname'.");
				return AdminStoreError::USERNAME_HAS_WHITESPACE;
			}
		}
		if ($addname[0] == '+') {
			# leading '+' is reserved for passwordless accounts
			$logger->warning(
				"Zapmin: usradd: name invalid: '$addname'.");
			return AdminStoreError::USERNAME_LEADING_PLUS;
		}

		return 0;
	}
660393
protected function getUsersPassword()
    {

        try {
            // load the application context
            $application = RequestHandler::getApplicationContext();

            // load and return the user's password or throw an exception
            return new String($application->search(sprintf('%s/%s', $this->userPathPrefix, $this->getUsername())));

        } catch (\Exception $e) {
            throw new LoginException('No matching username found in naming directory');
        }
    }