Skip to content

Commit

Permalink
cookie check
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa committed Apr 8, 2019
1 parent c3f0563 commit ae014f7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Token/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use DateTime;
use DateInterval;
use Config;
use Cookie;

class Token
{
Expand Down Expand Up @@ -41,8 +42,14 @@ public function tokon(){
$token_header = Config::get('kauth.token_header_name') ? Config::get('kauth.token_header_name') : 'tokon';
$tokon = \Request::header($token_header);

if(empty($tokon)){
return $_COOKIE[$token_header];
if($tokon === null && (Config::get('kauth.cookie_auth')) ){
try {
return $_COOKIE['kauth_token'];
} catch (\Exception $e) {
return $e;
}


}
return $tokon;
}
Expand Down

0 comments on commit ae014f7

Please sign in to comment.