Skip to content

Commit

Permalink
Captive login validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas K. Dionysopoulos committed Mar 17, 2016
1 parent 0e3e7fa commit c9f459c
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 12 deletions.
1 change: 0 additions & 1 deletion administrator/components/com_joomlaupdate/controller.php
Expand Up @@ -67,7 +67,6 @@ public function display($cachable = false, $urlparams = false)
$view->setModel($model, true);
$view->setLayout($lName);


// Push document object into the view.
$view->document = $document;
$view->display();
Expand Down
11 changes: 0 additions & 11 deletions administrator/components/com_joomlaupdate/views/upload/captive.php

This file was deleted.

@@ -0,0 +1,103 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

JHtml::_('behavior.keepalive');
JHtml::_('bootstrap.tooltip');

require_once JPATH_ADMINISTRATOR . '/modules/mod_login/helper.php';

$twofactormethods = ModLoginHelper::getTwoFactorMethods();
$language = JFactory::getLanguage();

?>
<div class="alert alert-warning">
<h4 class="alert-heading">
<?php echo JText::_('COM_JOOMLAUPDATE_VIEW_UPLOAD_CAPTIVE_INTRO_HEAD'); ?>
</h4>
<p>
<?php echo JText::sprintf('COM_JOOMLAUPDATE_VIEW_UPLOAD_CAPTIVE_INTRO_BODY', JFactory::getConfig()->get('sitename')); ?>
</p>
</div>

<hr/>

<form action="<?php echo JRoute::_('index.php', true); ?>" method="post" id="form-login" class="form-inline">
<fieldset class="loginform">
<div class="control-group">
<div class="controls">
<div class="input-prepend input-append">
<span class="add-on">
<span class="icon-user hasTooltip" title="<?php echo JText::_('JGLOBAL_USERNAME'); ?>"></span>
<label for="mod-login-username" class="element-invisible">
<?php echo JText::_('JGLOBAL_USERNAME'); ?>
</label>
</span>
<input name="username" tabindex="1" id="mod-login-username" type="text" class="input-medium" placeholder="<?php echo JText::_('JGLOBAL_USERNAME'); ?>" size="15" autofocus="true" />
<a href="<?php echo JUri::root(); ?>index.php?option=com_users&view=remind" class="btn width-auto hasTooltip" title="<?php echo JText::_('MOD_LOGIN_REMIND'); ?>">
<span class="icon-help"></span>
</a>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<div class="input-prepend input-append">
<span class="add-on">
<span class="icon-lock hasTooltip" title="<?php echo JText::_('JGLOBAL_PASSWORD'); ?>"></span>
<label for="mod-login-password" class="element-invisible">
<?php echo JText::_('JGLOBAL_PASSWORD'); ?>
</label>
</span>
<input name="passwd" tabindex="2" id="mod-login-password" type="password" class="input-medium" placeholder="<?php echo JText::_('JGLOBAL_PASSWORD'); ?>" size="15"/>
<a href="<?php echo JUri::root(); ?>index.php?option=com_users&view=reset" class="btn width-auto hasTooltip" title="<?php echo JText::_('MOD_LOGIN_RESET'); ?>">
<span class="icon-help"></span>
</a>
</div>
</div>
</div>
<?php if (count($twofactormethods) > 1): ?>
<div class="control-group">
<div class="controls">
<div class="input-prepend input-append">
<span class="add-on">
<span class="icon-star hasTooltip" title="<?php echo JText::_('JGLOBAL_SECRETKEY'); ?>"></span>
<label for="mod-login-secretkey" class="element-invisible">
<?php echo JText::_('JGLOBAL_SECRETKEY'); ?>
</label>
</span>
<input name="secretkey" autocomplete="off" tabindex="3" id="mod-login-secretkey" type="text" class="input-medium" placeholder="<?php echo JText::_('JGLOBAL_SECRETKEY'); ?>" size="15"/>
<span class="btn width-auto hasTooltip" title="<?php echo JText::_('JGLOBAL_SECRETKEY_HELP'); ?>">
<span class="icon-help"></span>
</span>
</div>
</div>
</div>
<?php endif; ?>
<div class="control-group">
<div class="controls">
<div class="btn-group">
<a tabindex="4" class="btn btn-danger" href="index.php?option=com_joomlaupdate">
<span class="icon-cancel icon-white"></span> <?php echo JText::_('JCANCEL'); ?>
</a>
</div>
<div class="btn-group">
<button tabindex="5" class="btn btn-primary">
<span class="icon-play icon-white"></span> <?php echo JText::_('COM_INSTALLER_INSTALL_BUTTON'); ?>
</button>
</div>
</div>
</div>

<input type="hidden" name="option" value="com_joomlaupdate"/>
<input type="hidden" name="task" value="update.confirm"/>
<?php echo JHtml::_('form.token'); ?>
</fieldset>
</form>
@@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_joomlaupdate
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

/**
* Joomla! Update's Update View
*
* @since 3.5.0
*/
class JoomlaupdateViewUpload extends JViewLegacy
{
public function display($tpl=null)
{
// Set the toolbar information.
JToolbarHelper::title(JText::_('COM_JOOMLAUPDATE_OVERVIEW'), 'loop install');
JToolBarHelper::divider();
JToolBarHelper::help('JHELP_COMPONENTS_JOOMLA_UPDATE');

// Load com_installer's language
$language = JFactory::getLanguage();
$language->load('com_installer', JPATH_ADMINISTRATOR, 'en-GB', false, true);
$language->load('com_installer', JPATH_ADMINISTRATOR, null, true);

$language->load('mod_login', JPATH_ADMINISTRATOR, 'en-GB', false, true);
$language->load('mod_login', JPATH_ADMINISTRATOR, null, true);

// Import com_login's model
if (!class_exists('LoginModelLogin'))
{
@include_once JPATH_ADMINISTRATOR . '/components/com_login/models/login.php';
}

// Render the view.
parent::display($tpl);
}
}
2 changes: 2 additions & 0 deletions administrator/language/en-GB/en-GB.com_joomlaupdate.ini
Expand Up @@ -61,3 +61,5 @@ COM_JOOMLAUPDATE_XML_DESCRIPTION="Updates Joomla to the latest version with one
COM_JOOMLAUPDATE_VIEW_DEFAULT_TAB_ONLINE="Live Update"
COM_JOOMLAUPDATE_VIEW_DEFAULT_TAB_UPLOAD="Upload & Update"
COM_JOOMLAUPDATE_VIEW_DEFAULT_UPLOAD_INTRO="You can use this feature to update Joomla! if your server is behind a firewall or otherwise unable to contact the update servers. First download the Joomla! <em>Upgrade Package</em> in ZIP format from <a href=\"%s\">the official Joomla! download page</a>. Then use the fields below to upload and install it."
COM_JOOMLAUPDATE_VIEW_UPLOAD_CAPTIVE_INTRO_HEAD="Are you sure you want to install the file you uploaded?"
COM_JOOMLAUPDATE_VIEW_UPLOAD_CAPTIVE_INTRO_BODY="Make sure that the update file you have uploaded comes from the official Joomla! download page. Afterwards, please confirm that you want to install it by re-entering the login information for your site “%s” below."

0 comments on commit c9f459c

Please sign in to comment.