1

I have inserted a button in a system plugin that will open an iframe in a modal window. The iframe content is administration login page. The issue is if I am logged in administration, the iframe also will be logged in. Is it possible to load the iframe without session?

<a href="http://www.example.com/administration" class="modal-button btn modal" style ="min-width: 194px;" rel="{handler: \'iframe\', size: {x:window.getSize().x-100, y: window.getSize().y-100}}" id="modalLink1"><span class="icon-screen"> </span> Preview</a>

Tried:

Add a preview parameter in the link:

<a href="http://www.example.com/administrator/index.php?preview=1" class="modal-button btn modal" style ="min-width: 194px;" rel="{size: {x:window.getSize().x-100, y: window.getSize().y-100}}"><span class="icon-screen"> </span> Preview</a>';

Set a cookie and unset session:

if ($input->get->get('preview', false) === '1') {
    $input->cookie->set('preview', '1', 0, $config->get('cookie_path'), $config->get('cookie_domain'), false, true);
    unset($_SESSION);
}

This could be a way of doing it?

  • Do you need this button if you are already logged in? Why not hide the button if you are logged in in the administration? – jonasfh Mar 4 '15 at 21:52
  • @jonasfh When I am logged in administration I need to show in a popup window (inside my plugin) how administration login page looks like. Only to show. – n.h. Mar 4 '15 at 22:07
1

To make it simple, if you only want to show an example, I would do this:

<?php JHTML::_('behavior.modal'); ?>

and

<a href="http://www.example.com/images/admin-login-example.png" 
class="modal-button btn modal" style ="min-width: 194px;" 
id="modalLink1"><span class="icon-screen"> </span> Preview</a>

where admin-login-example.png is a small screenshot of the login-page.

...so you don't have to worry about showing a live login form just as an example...

  • Yes, indeed that is one way. What do you think about my last update to the question? – n.h. Mar 4 '15 at 22:24
  • Have not tried this, but I would think that your user would be logged out of the administrator... – jonasfh Mar 4 '15 at 22:26
  • In the new window the user will be logged out but not in parent window. My doubt is the use of unset($_SESSION) – n.h. Mar 4 '15 at 22:31
  • Well, if it works for you, I don't think there should be problems. You should probably test what happens if you try to log in on the modal-view. – jonasfh Mar 4 '15 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.