-
Notifications
You must be signed in to change notification settings - Fork 3
Login
Stanislav Opletal edited this page Jul 27, 2017
·
2 revisions
Relisoft\Steam\Src\Login\Button::rectangle()Relisoft\Steam\Src\Login\Button::square()Login object using session to store states between the application but you have to add session source by your own. This i made because i am using nette framework and it's have own session api.
$this->login = new Login($this->session->getSection("steam"));
OR
$this->login = new Login($_SESSION);Using login object whitch we created above and use function
auth
$return = $login->auth();What it returns? Its return 3 type of states:
if($object) //If success returning STEAM ID
{
$this->flashMessage("successfuly logged in $object");
$this->redirect("single",$object);
}
elseif($object == $login::FAILED)
{
$this->flashMessage("Steam is not logged in!");
$this->redirect("this");
}
elseif($object == $login::CANCEL)
{
$this->flashMessage("Cancel by user");
$this->redirect("this");
}And that's it... Your login is good. But wait... We forgot for one think. If someone call your function it will be every time redirecting him into steam. So easy add one if and everything is complete.
if($login->isLogged())
{
$this->flashMessage("User is logged.");
$this->redirect("single",$this->session->getSection("steam")->user);
}
else
{
$object = $login->auth();
if($object)
{
$this->flashMessage("successfuly logged in $object");
$this->redirect("single",$object);
}
elseif($object == $login::FAILED)
{
$this->flashMessage("Steam is not logged in!");
$this->redirect("this");
}
elseif($object == $login::CANCEL)
{
$this->flashMessage("Cancel by user");
$this->redirect("this");
}
}

