Commit 1d05f6d4 authored by Thibaut Vallee's avatar Thibaut Vallee Committed by David Surville
Browse files

correctif du bug sur les menu de connection

parent 9e0af58c
Loading
Loading
Loading
Loading
+17 −19
Original line number Diff line number Diff line
<?php

use UnicaenAuth\Authentication\Adapter;
use UnicaenAuth\Form\LoginForm;
use UnicaenAuth\View\Helper\AbstractConnectViewHelper;
use UnicaenAuthentification\Authentication\Adapter;
use UnicaenAuthentification\Form\LoginForm;
use UnicaenAuthentification\View\Helper\AbstractConnectViewHelper;

/**
 * Génération des différents types de formulaire de connexion activés.
@@ -26,7 +26,6 @@ $form->setAttributes([
$helpers = [];
foreach ($types as $t => $config) {
    $helpers[$t] = $this->connect($t, $form);
    /** @see \UnicaenAuth\View\Helper\ConnectViewHelper */
}

$activeHelper = null;
@@ -37,9 +36,11 @@ $activeHelper = null;
        <ul class="nav nav-tabs card-header-tabs" role="tablist">
            <?php foreach ($helpers as $key => $helper): ?>
                <?php
                $query = $redirect ? ['redirect' => $redirect] : [];
                if ($key === $type) {
                    $activeClass = 'active';
                    $ariaSelected = 'true';
                    $activeHelper = $helper;
                } else {
                    if (isset($forms[$key]) && $forms[$key]->isHidden()) {
                        continue;
@@ -49,26 +50,23 @@ $activeHelper = null;
                }
                ?>
                <li role="presentation" class="nav-item">
                    <button class="nav-link <?= $activeClass ?>" id="<?= $key ?>-tab" data-bs-toggle="tab"
                            data-bs-target="#<?= $key ?>" type="button"
                            role="tab" aria-controls="<?= $key ?>" aria-selected="<?= $ariaSelected ?>">
                    <a class="nav-link <?= $activeClass ?>" type="button"
                       role="tab" aria-selected="<?= $ariaSelected ?>"
                       href="<?= $this->url('zfcuser/login', ['type' => $key], ['query' => $query]) ?>"
                    >
                        <?= $helper->getTitle() ?>
                    </button>
                    </a>
                </li>
            <?php endforeach ?>
        </ul>
    </div>
    <div class="card-body tab-content">
        <?php foreach ($helpers as $key => $helper): ?>
            <?php $activeClass = ($key === $type) ? 'active' : '';?>
            <div class="tab-pane <?= $activeClass ?>" id="<?= $key ?>" role="tabpanel"
                 aria-labelledby="<?= $key ?>-tab">
                <?php
                $title = $helper->getTitle();
                $helper->setTitle(""); // pour éviter que le title soit répété
        <div class="tab-pane active" role="tabpanel">
            <?php if (isset($activeHelper)) {
                $activeHelper->setTitle(""); // pour éviter que le title soit répété
                echo $activeHelper;
            }
            ?>
                <?= (string) $helper ?>
        </div>
        <?php endforeach ?>
    </div>
</div>
 No newline at end of file
+3 −3
Original line number Diff line number Diff line
@@ -8,11 +8,11 @@
 * @var string $redirect URL demandée nécessitant authentification
 * @var bool $enableRegistration
 *
 * @see \UnicaenAuth\Controller\AuthController::loginAction()
 * @see \UnicaenAuthentification\Controller\AuthController::loginAction()
 */

use Application\View\Renderer\PhpRenderer;
use UnicaenAuth\Form\LoginForm;
use UnicaenAuthentification\Form\LoginForm;
use Laminas\Form\Form;

$this->headTitle("Connexion") ?>