Browse Source

Trying some stuff out

Brendan Abolivier 8 years ago
parent
commit
7c95862c94
1 changed files with 12 additions and 5 deletions
  1. 12
    5
      auth.php

+ 12
- 5
auth.php View File

64
 	}
64
 	}
65
 
65
 
66
 	function loginpage_hook() {
66
 	function loginpage_hook() {
67
-		global $DB;
67
+		global $DB, $login;
68
 		$message = "";
68
 		$message = "";
69
 		if(!empty($_COOKIE['das-macaroon'])) {
69
 		if(!empty($_COOKIE['das-macaroon'])) {
70
 			try {
70
 			try {
78
 
78
 
79
 				if($v->verify($m, "pocsecret")) {
79
 				if($v->verify($m, "pocsecret")) {
80
 					$name = explode(";", $m->getIdentifier());
80
 					$name = explode(";", $m->getIdentifier());
81
-					$username = join("", $name);
82
-					$user = authenticate_user_login($username, null);
81
+					$login = join("", $name);
82
+					$user = authenticate_user_login($login, null);
83
 
83
 
84
 					if($user) {
84
 					if($user) {
85
 						$user->firstname = $name[0];
85
 						$user->firstname = $name[0];
86
 						$user->lastname = $name[1];
86
 						$user->lastname = $name[1];
87
-						$user->email = $username."@brendanabolivier.com";
87
+						$user->email = $login."@brendanabolivier.com";
88
 						//	var_dump($user);
88
 						//	var_dump($user);
89
 						$DB->update_record('user', $user);
89
 						$DB->update_record('user', $user);
90
 						complete_user_login($user);
90
 						complete_user_login($user);
105
 	 * @return bool Authentication success or failure.
105
 	 * @return bool Authentication success or failure.
106
 	 */
106
 	 */
107
 	function user_login ($username, $password) {
107
 	function user_login ($username, $password) {
108
-		return true;
108
+		global $login;
109
+		if($login == $username) {
110
+			return true;
111
+		}
112
+		return false;
109
 	}
113
 	}
110
 
114
 
111
 	/**
115
 	/**
196
 		return true;
200
 		return true;
197
 	}
201
 	}
198
 
202
 
203
+	function is_synchronised_with_external() {
204
+		return false;
205
+	}
199
 }
206
 }
200
 
207
 
201
 
208