Initial version with functionality to log into the component using frontend

This commit is contained in:
2019-03-30 17:01:31 +01:00
commit 773eb1092d
20 changed files with 491 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<?php
// No direct access.
defined('_JEXEC') or die;
?>
asd

View File

@@ -0,0 +1,10 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
// No direct access.
defined('_JEXEC') or die;
class ClubsViewClubs extends HtmlView
{
}

View File

@@ -0,0 +1,22 @@
<?php
use Joomla\CMS\Factory;
if($this->state === "failed")
{
?>
<p class='error'>Benutzername oder Passwort sind falsch.</p>
<?php
}
?>
<form method="post" action="?option=com_clubs&task=login.login">
<p>
Username:<br />
<input name="user" type="text">
</p>
<p>
Passwort:<br />
<input name="password" type="password">
</p>
<p><input type="checkbox" name='keep' value='true' <?php if(Factory::getApplication()->input->cookie->get('clubsLoginKeepLoggedIn','') === 'true') echo "checked";?>> Keep me logged in</p>
<p><input type="submit" value="Einloggen"></p>
</form>

View File

@@ -0,0 +1,7 @@
<?php
// No direct access.
defined('_JEXEC') or die;
?>
<a href='?option=com_clubs&task=login.logout'>Logout</a>

View File

@@ -0,0 +1,30 @@
<?php
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
// No direct access.
defined('_JEXEC') or die;
JLoader::register("ClubsHelperAuth", JPATH_ROOT . "/components/com_clubs/helpers/auth.php");
class ClubsViewLogin extends HtmlView
{
public function display($tpl = null)
{
$helper = new ClubsHelperAuth();
if($helper->checkCookie())
{
// we are logged in
$this->setLayout('logout');
parent::display(null);
}
else
{
$this->state = Factory::getApplication()->input->get("state", "");
parent::display($tpl);
}
}
}