From fc49b895ef2e38bbc820b3eda503a8afdbaabe44 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <jkowalsk@student.agh.edu.pl>
Date: Thu, 20 Aug 2015 13:25:27 +0000
Subject: [PATCH] Add isAuthenticated() method to check whether user is already logged in

---
 uphpCAS.php |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/uphpCAS.php b/uphpCAS.php
index ea04ed6..2b734f4 100644
--- a/uphpCAS.php
+++ b/uphpCAS.php
@@ -71,9 +71,13 @@
 		die();
 	}
 	
+	public function isAuthenticated() {
+		return isset($_SESSION['uphpCAS-user']);
+	}
+	
 	public function authenticate() {
 		session_start();
-		if(isset($_SESSION['uphpCAS-user'])) {
+		if($this->isAuthenticated()) {
 			return $_SESSION['uphpCAS-user'];
 		} elseif(isset($_REQUEST['ticket'])) {
 			$user = $this->verifyTicket($_REQUEST['ticket']);

--
Gitblit v1.9.1