• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/outlookapplication.php
  • Класс: BitrixIntranetOutlookApplication
  • Вызов: OutlookApplication::generateAppPassword
static function generateAppPassword($type = '')
{
	global $USER;

	$password = ApplicationPasswordTable::generatePassword();

	$message = Loc::getMessage('WS_OUTLOOK_APP_SYSCOMMENT');
	if($type)
	{
		$typeTitle = Loc::getMessage('WS_OUTLOOK_APP_TYPE_'.$type);
		if($typeTitle <> '')
		{
			$message = Loc::getMessage('WS_OUTLOOK_APP_SYSCOMMENT_TYPE', array(
				'#TYPE#' => $typeTitle,
			));
		}
	}

	$res = ApplicationPasswordTable::add(array(
		'USER_ID' => $USER->getID(),
		'APPLICATION_ID' => static::ID,
		'PASSWORD' => $password,
		'DATE_CREATE' => new DateTime(),
		'COMMENT' => Loc::getMessage('WS_OUTLOOK_APP_COMMENT'),
		'SYSCOMMENT' => $message,
	));

	if($res->isSuccess())
	{
		return $password;
	}

	return false;
}