Got the log out working.

This commit is contained in:
Josh Sherman 2013-12-16 22:17:39 -05:00
parent 74257193f1
commit 34c41764b5
4 changed files with 26 additions and 19 deletions

View file

@ -27,7 +27,7 @@ class User extends RedisModel
return false;
}
public static function getCookie()
public function getCookie()
{
if (isset($_COOKIE['__auth']))
{
@ -38,10 +38,11 @@ class User extends RedisModel
}
public static function isAuthenticated()
{
if ($cookie = self::getCookie())
{
$user = new self();
if ($cookie = $user->getCookie())
{
$auth_token = $user->getAuth($cookie['uid']);
return $auth_token === $cookie['token'];

View file

@ -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();
}
}

View file

@ -8,6 +8,8 @@
'name' => 'email',
'class' => 'form-control input-lg email required',
'placeholder' => 'Your email address, double check it!',
'autocomplete' => 'off',
'autofocus' => 'autofocus',
))
);
@ -20,6 +22,7 @@
'minlength' => 4,
'maxlength' => 50,
'placeholder' => 'At least four letters or numbers',
'autocomplete' => 'off',
))
);
@ -31,6 +34,7 @@
'class' => 'form-control input-lg required',
'minlength' => 8,
'placeholder' => 'Use symbols along with letters and numbers',
'autocomplete' => 'off',
))
);
?>

View file

@ -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(