diff --git a/models/User.php b/models/User.php index a66c4a1..4948645 100644 --- a/models/User.php +++ b/models/User.php @@ -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']; diff --git a/modules/logout.php b/modules/logout.php index c88e140..25ac0d6 100644 --- a/modules/logout.php +++ b/modules/logout.php @@ -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(); } } diff --git a/templates/join.phtml b/templates/join.phtml index 5a9c7ed..7439255 100644 --- a/templates/join.phtml +++ b/templates/join.phtml @@ -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', )) ); ?> diff --git a/templates/login.phtml b/templates/login.phtml index b48185b..8d7b009 100644 --- a/templates/login.phtml +++ b/templates/login.phtml @@ -1,4 +1,4 @@ -
+

Sign in Welcome back!

html->div(