Help to deal with such a topic, added a modal window for authorization and registration to the site in the header, but authorization works only on pages:

mysayt.ru / user / login myysayt.ru / user / register

How to make it work on all pages of the site from the modal window?

Link to the site: ylino.ru (without modal window)

I will be grateful for the help

CODE OF MY MODULAR WINDOW:

<?php /** * Авторизация * @var $this Users */ ?> <div class="cd-user-modal"> <!-- this is the entire modal form, including the background --> <div class="cd-user-modal-container"> <!-- this is the container wrapper --> <ul class="cd-switcher"> <li><a href="#signin">Авторизация</a></li> <li><a href="#signup">Регистрация</a></li> </ul> <div id="cd-login"> <!-- log in form --> <form id="ju-login-form" action="" class="cd-form"> <input type="hidden" name="back" value="<?= HTML::escape($back) ?>" /> <p class="fieldset"> <label class="image-replace cd-email" for="ju-login-email"><?= _t('users', 'Электронная почта') ?></label> <input type="email" name="email" id="ju-login-email" class="full-width has-padding has-border" placeholder="<?= _t('users', 'Введите ваш email') ?>" autocorrect="off" autocapitalize="off"> <span class="cd-error-message">Ошибка, укажите вашу почту!</span> </p> <p class="fieldset"> <label class="image-replace cd-password" for="ju-login-pass"><?= _t('users', 'Пароль') ?></label> <input type="password" name="pass" id="ju-login-pass" class="full-width has-padding has-border" placeholder="<?= _t('users', 'Введите ваш пароль') ?>"> <a href="#0" class="hide-password">Показать</a> <span class="cd-error-message">Ошибка, укажите ваш пароль!</span> </p> <p class="fieldset"> <input type="checkbox" name="remember" id="remember-me" autocomplete="on" checked> <label for="remember-me"><?= _t('users', 'Запомните меня'); ?></label> </p> <p class="fieldset"> <button type="submit" class="full-width j-submit"><?= _t('users', 'Войти на сайт') ?></button> </p> </form> <p class="cd-form-bottom-message"><a href="#0">Забыли пароль?</a></p> <a href="#0" class="cd-close-form">Закрыть</a> </div> <!-- cd-login --> <div id="cd-signup"> <!-- sign up form --> <form id="ju-register-form" action="" class="cd-form"> <input type="hidden" name="back" value="<?= HTML::escape($back) ?>" /> <!-- <p class="fieldset"> <label class="image-replace cd-username" for="signup-username">Имя полизователя</label> <input class="full-width has-padding has-border" id="signup-username" type="text" placeholder="Придумайте имя"> <span class="cd-error-message">Error message here!</span> </p> --> <? if($phone_on) { ?> <p class="fieldset"> <label class="image-replace cd-phone" for="ju-register-phone signup-phone"><?= _t('users', 'Телефон') ?></label> <div class="controls form-control-phone"> <?= $this->registerPhoneInput(array('id'=>'ju-register-phone','name'=>'phone')) ?> </div> </p> <? } ?> <p class="fieldset"> <label class="image-replace cd-email" for="ju-register-email">E-mail</label> <input type="email" name="email" class="full-width has-padding has-border j-required" id="ju-register-email" autocomplete="off" placeholder="<?= _t('users', 'Введите ваш email') ?>" maxlength="100" autocorrect="off" autocapitalize="off"> <span class="cd-error-message">Ошибка, вы забыли указать вашу эл. почту!</span> </p> <p class="fieldset"> <label class="image-replace cd-password" for="ju-register-pass">Пароль</label> <input type="password" name="pass" class="full-width has-padding has-border j-required" id="ju-register-pass" autocomplete="off" placeholder="<?= _t('users', 'Придумайте пароль') ?>" maxlength="100"> <a href="#0" class="hide-password">Показать</a> <span class="cd-error-message">Ошибка, вы забыли указать пароль!</span> </p> <p class="fieldset"> <input type="checkbox" name="agreement" id="ju-register-agreement" autocomplete="on"> <label for="accept-terms"><?= _t('users', 'Я соглашаюсь с <a href="[link_agreement]" target="_blank">правилами использования сервиса.</a>', array('link_agreement'=>Users::url('agreement'))) ?></label> </p> <p class="fieldset"> <button class="full-width has-padding j-submit" type="submit"><?= _t('users', 'Создать профиль') ?></button> </p> </form> <a href="#0" class="cd-close-form">Закрыть</a> </div> <!-- cd-signup --> <div id="cd-reset-password"> <!-- reset password form --> <p class="cd-form-message">Забыли пароль? Пожалуйста, введите Ваш адрес электронной почты. Вы получите ссылку для создания нового пароля.</p> <form class="cd-form"> <p class="fieldset"> <label class="image-replace cd-email" for="reset-email">E-mail</label> <input class="full-width has-padding has-border" id="reset-email" type="email" placeholder="Укажите ваш адрес эл. почты"> <span class="cd-error-message">Ошибка, укажите эл.почту</span> </p> <p class="fieldset"> <button class="full-width has-padding" type="submit" value="Восстановить"></button> </p> </form> <p class="cd-form-bottom-message"><a href="javascript:void(0);">Вернутся к авторизации</a></p> </div> <!-- cd-reset-password --> <a href="javascript:void(0);" class="cd-close-form">Закрыть</a> </div> <!-- cd-user-modal-container --> </div> <!-- cd-user-modal --> 

handler code https://gist.github.com/baytalov/521e7b56c60dcd3da199d028b9b029cc

DEMO MODULAR WINDOWS WHICH I HAVE INTRODUCED

  • But what does "authorization work only on pages"? What should happen on other pages? - Ivan Bolnikh
  • the authorization only takes place on the tech pages that I have recruited, but on others nothing happens, and it should be on any pages - Karen Baytalov

1 answer 1

You do not have a path to the processor in the modal window in action, so the data from the form is sent to the page where the user is located.

  • I correctly understood that I need to add this action to action = "/ user / login"? - Karen Baytalov
  • yes, try it. - Denis Heavenly
  • goes to the page mySayt.ru / user / login and nothing happens, just get on the login page (original) - Karen Baytalov
  • Can you give the model code if necessary? - Karen Baytalov
  • Look at the logs, namely whether the data is transmitted to the processor. You use Ajax, so you need to understand in more detail here. Provide a handler code. - Denis Heavenly