{ifmodule USER_OAUTH}
<div class="oauth-box">
   {if $ctrl.logged}
      {get_logged_user_provider_ids assign='userProviderIDs'}

      {foreach $userProviderIDs as $providerIDRow}
         {if $providerIDRow.provider == "facebook"}
            {$fbRemove = $providerIDRow}
         {elseif $providerIDRow.provider == "google"}
            {$googleRemove = $providerIDRow}
         {elseif $providerIDRow.provider == 'seznam'}
            {$seznamRemove = $providerIDRow}
         {elseif $providerIDRow.provider == 'amazon'}
            {$amazonRemove = $providerIDRow}
         {elseif $providerIDRow.provider == 'apple'}
            {$appleRemove = $providerIDRow}
         {/if}
      {/foreach}
   {/if}

   {block "oauth-text"}
      <h2>{t}Rychlá registrace pomocí sociálních sítí{/t}</h2>
   {/block}

   <div class="oauth-buttons">
      {if $dbcfg.oauth.facebook.client_id}
         {if $fbRemove}
            <a href="/login-unbind/{$fbRemove.id}" class="btn fb active"><span class="icon"></span>
               <span class="text">{t}Odpojit{/t} <small>{$fbRemove.email}</small></span>
            </a>
         {else}
            <a href="/login-bind/facebook" class="btn fb"><span class="icon"></span><span class="text">Facebook</span></a>
         {/if}
      {/if}
      {if $dbcfg.oauth.facebook.client_id and $dbcfg.oauth.google.client_id}
         <span>{t}nebo{/t}</span>
      {/if}
      {if $dbcfg.oauth.google.client_id}
         {if $googleRemove}
            <a href="/login-unbind/{$googleRemove.id}" class="btn gp active"><span class="icon"></span>
               <span class="text"> {t}Odpojit{/t} <small>{$googleRemove.email}</small></span>
            </a>
         {else}
            <a href="/login-bind/google" class="btn gp"><span class="icon"></span><span class="text">Google</span></a>
         {/if}
      {/if}
      {ifmodule USER_OAUTH__SEZNAM_LOGIN}
      {if $dbcfg.oauth.seznam.client_id}
         {if $seznamRemove}
            <a href="/login-unbind/{$seznamRemove.id}" class="btn sz active"><span class="icon"></span>
               <span class="text"> {t}Odpojit{/t} <small>{$seznamRemove.email}</small></span>
            </a>
         {else}
            <a href="/login-bind/seznam" class="btn sz"><span class="icon"></span><span class="text">Seznam</span></a>
         {/if}
      {/if}
      {/ifmodule}
      {ifmodule USER_OAUTH__AMAZON_LOGIN}
      {if $dbcfg.oauth.amazon.client_id}
         {if $amazonRemove}
            <a href="/login-unbind/{$amazonRemove.id}" class="btn amazon active"><span class="icon"></span>
               <span class="text"> {t}Odpojit{/t} <small>{$amazonRemove.email}</small></span>
            </a>
         {else}
            <a href="/login-bind/amazon" class="btn amazon"><span class="icon"></span><span class="text">Amazon</span></a>
         {/if}
      {/if}
      {/ifmodule}
      {ifmodule USER_OAUTH__APPLE_LOGIN}
      {if $dbcfg.oauth.apple.client_id}
         {if $appleRemove}
            <a href="/login-unbind/{$appleRemove.id}" class="btn apple active"><span class="icon"></span>
               <span class="text"> {t}Odpojit{/t} <small>{$appleRemove.email}</small></span>
            </a>
         {else}
            <a href="/login-bind/apple" class="btn apple"><span class="icon"></span><span class="text">Apple</span></a>
         {/if}

      {/if}
      {/ifmodule}
   </div>
</div>
{/ifmodule}
