Got the log out working.
This commit is contained in:
parent
74257193f1
commit
34c41764b5
4 changed files with 26 additions and 19 deletions
|
@ -27,7 +27,7 @@ class User extends RedisModel
|
|||
return false;
|
||||
}
|
||||
|
||||
public static function getCookie()
|
||||
public function getCookie()
|
||||
{
|
||||
if (isset($_COOKIE['__auth']))
|
||||
{
|
||||
|
@ -39,9 +39,10 @@ class User extends RedisModel
|
|||
|
||||
public static function isAuthenticated()
|
||||
{
|
||||
if ($cookie = self::getCookie())
|
||||
$user = new self();
|
||||
|
||||
if ($cookie = $user->getCookie())
|
||||
{
|
||||
$user = new self();
|
||||
$auth_token = $user->getAuth($cookie['uid']);
|
||||
|
||||
return $auth_token === $cookie['token'];
|
||||
|
|
|
@ -7,6 +7,8 @@ class logout extends UserModule
|
|||
$user = new User();
|
||||
$user->setAuth($user->getAuthenticated('uid'), $user->generateToken());
|
||||
|
||||
setcookie('__auth', '', time() - Time::YEAR, '/');
|
||||
|
||||
Browser::goHome();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,33 +4,37 @@
|
|||
echo $this->html->div(
|
||||
array('class' => 'form-group'),
|
||||
$this->html->inputEmail(array(
|
||||
'label' => 'Email Address',
|
||||
'name' => 'email',
|
||||
'class' => 'form-control input-lg email required',
|
||||
'placeholder' => 'Your email address, double check it!',
|
||||
'label' => 'Email Address',
|
||||
'name' => 'email',
|
||||
'class' => 'form-control input-lg email required',
|
||||
'placeholder' => 'Your email address, double check it!',
|
||||
'autocomplete' => 'off',
|
||||
'autofocus' => 'autofocus',
|
||||
))
|
||||
);
|
||||
|
||||
echo $this->html->div(
|
||||
array('class' => 'form-group'),
|
||||
$this->html->input(array(
|
||||
'label' => 'Username',
|
||||
'name' => 'username',
|
||||
'class' => 'form-control input-lg required',
|
||||
'minlength' => 4,
|
||||
'maxlength' => 50,
|
||||
'placeholder' => 'At least four letters or numbers',
|
||||
'label' => 'Username',
|
||||
'name' => 'username',
|
||||
'class' => 'form-control input-lg required',
|
||||
'minlength' => 4,
|
||||
'maxlength' => 50,
|
||||
'placeholder' => 'At least four letters or numbers',
|
||||
'autocomplete' => 'off',
|
||||
))
|
||||
);
|
||||
|
||||
echo $this->html->div(
|
||||
array('class' => 'form-group'),
|
||||
$this->html->inputPassword(array(
|
||||
'label' => 'Password',
|
||||
'name' => 'password',
|
||||
'class' => 'form-control input-lg required',
|
||||
'minlength' => 8,
|
||||
'placeholder' => 'Use symbols along with letters and numbers',
|
||||
'label' => 'Password',
|
||||
'name' => 'password',
|
||||
'class' => 'form-control input-lg required',
|
||||
'minlength' => 8,
|
||||
'placeholder' => 'Use symbols along with letters and numbers',
|
||||
'autocomplete' => 'off',
|
||||
))
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<form role="form" class="row col-xs-12 col-sm-6 col-sm-offset-3" method="post">
|
||||
<form role="form" class="row col-xs-12 col-sm-6 col-sm-offset-3" method="post" action="/user/authenticate">
|
||||
<h1>Sign in <small>Welcome back!</small></h1>
|
||||
<?php
|
||||
echo $this->html->div(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue