<?php
/**
 * @package    VP Advanced User
 * @author     Abhishek Das <info@virtueplanet.com>
 * @copyright  Copyright (C) 2012-2019 VirtuePlanet Services LLP. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 * @link       https://www.virtueplanet.com
 */

defined('_JEXEC') or die;

$return = $this->form->getValue('return', '', $this->myparams->get('login_redirect_url', $this->myparams->get('login_redirect_menuitem')));
?>
<div id="vp-login-content" class="vp-tab-content">
	<?php if($this->myparams->get('enable_social_login') && $this->myparams->get('show_in_login')) : ?>
		<?php echo JLayoutHelper::render('social_buttons', array('show' => true, 'size' => 'standard', 'params' => $this->myparams, 'action' => 'LOGIN', 'return' => VPAdvancedUserHelperUtility::encode($return)), null, array('component' => 'com_vpadvanceduser')); ?>
		<div class="vp-or-container">
			<hr class="vp-or-hr" />
			<div class="vp-or"><?php echo JText::_('COM_VPADVANCEDUSER_OR') ?></div>
		</div>
	<?php endif ?>
	<form action="<?php echo JRoute::_('index.php?option=com_vpadvanceduser&task=user.login'); ?>" method="post" role="form">
		<fieldset>
			<?php foreach ($this->form->getFieldset('credentials') as $field) : ?>
				<?php if (!$field->hidden) : ?>
					<div class="vp-form-group">
						<?php echo $field->label; ?>
						<?php echo $field->input; ?>
						<?php if($field->name == 'password') : ?>
							<div class="vp-field-help">
								<a href="<?php echo JRoute::_('index.php?option=com_vpadvanceduser&view=reset'); ?>"><?php echo JText::_('COM_USERS_LOGIN_RESET'); ?></a>
							</div>
						<?php endif ?>
					</div>
				<?php endif; ?>
			<?php endforeach; ?>
			<?php if ($this->tfa): ?>
				<div class="vp-form-group">
					<?php echo $this->form->getField('secretkey')->label; ?>
					<?php echo $this->form->getField('secretkey')->input; ?>
				</div>
			<?php endif; ?>
			<div class="vp-form-submission">
					<button type="submit" class="vp-btn vp-btn-primary vp-btn-lg"><?php echo JText::_('JLOGIN'); ?></button>
					<?php if (JPluginHelper::isEnabled('system', 'remember')) : ?>
						<div class="vp-checkbox">
							<label for="remember">
								<input id="remember" type="checkbox" name="remember" value="yes" /> <?php echo JText::_('COM_USERS_LOGIN_REMEMBER_ME') ?>
							</label>
						</div>
					<?php endif; ?>
			</div>
			<input type="hidden" name="task" value="user.login" />
			<input type="hidden" name="return" value="<?php echo VPAdvancedUserHelperUtility::encode($return); ?>" />
			<?php echo JHtml::_('form.token'); ?>
		</fieldset>
	</form>
</div>