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,7 +64,7 @@ class auth_plugin_macaroons extends auth_plugin_base {
64 64
 	}
65 65
 
66 66
 	function loginpage_hook() {
67
-		global $DB;
67
+		global $DB, $login;
68 68
 		$message = "";
69 69
 		if(!empty($_COOKIE['das-macaroon'])) {
70 70
 			try {
@@ -78,13 +78,13 @@ class auth_plugin_macaroons extends auth_plugin_base {
78 78
 
79 79
 				if($v->verify($m, "pocsecret")) {
80 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 84
 					if($user) {
85 85
 						$user->firstname = $name[0];
86 86
 						$user->lastname = $name[1];
87
-						$user->email = $username."@brendanabolivier.com";
87
+						$user->email = $login."@brendanabolivier.com";
88 88
 						//	var_dump($user);
89 89
 						$DB->update_record('user', $user);
90 90
 						complete_user_login($user);
@@ -105,7 +105,11 @@ class auth_plugin_macaroons extends auth_plugin_base {
105 105
 	 * @return bool Authentication success or failure.
106 106
 	 */
107 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,6 +200,9 @@ class auth_plugin_macaroons extends auth_plugin_base {
196 200
 		return true;
197 201
 	}
198 202
 
203
+	function is_synchronised_with_external() {
204
+		return false;
205
+	}
199 206
 }
200 207
 
201 208