Skip to content

Авторизация через соцсети без битриксовой модалки

Sergey edited this page Jul 23, 2015 · 2 revisions

В шаблоне system.auth.form:

<?foreach($arResult["AUTH_SERVICES"] AS $service):?>
  <?
     $img = '';
     switch(strtolower($service["ID"])){
        case 'vkontakte':
           $img = SITE_TEMPLATE_PATH.'/img/exit_vk.jpg';
           break;
        case 'facebook':
           $img = SITE_TEMPLATE_PATH.'/img/exit_fb.jpg';
           break;
     }
  ?>

  <a title="Вход через <?=$service["ID"]?>" href="javascript:void(0)" onclick="$('#bx_auth_serv_form<?=$service["ID"]?> a').eq(0).click();">
     <img alt="Вход <?=$service["ID"]?>" src="<?=$img?>">
  </a>
<?endforeach?>

<div style="display:none">
  <?
  $APPLICATION->IncludeComponent("bitrix:socserv.auth.form", "",
     array(
        "AUTH_SERVICES" => $arResult["AUTH_SERVICES"],
        "AUTH_URL" => $arResult["AUTH_URL"],
        "POST" => $arResult["POST"],
        "POPUP" => "N",
        "SUFFIX" => "form",
     ),
     $component,
     array("HIDE_ICONS" => "Y")
  );
  ?>
</div>
Clone this wiki locally