|
@@ -53,8 +53,18 @@ class auth_plugin_macaroons extends auth_plugin_base {
|
53
|
53
|
$this->authtype = 'macaroons';
|
54
|
54
|
}
|
55
|
55
|
|
|
56
|
+ /**
|
|
57
|
+ * Old syntax of class constructor. Deprecated in PHP7.
|
|
58
|
+ *
|
|
59
|
+ * @deprecated since Moodle 3.1
|
|
60
|
+ */
|
|
61
|
+ public function auth_plugin_macaroons() {
|
|
62
|
+ debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
|
63
|
+ self::__construct();
|
|
64
|
+ }
|
|
65
|
+
|
56
|
66
|
function loginpage_hook() {
|
57
|
|
- global $message, $DB;
|
|
67
|
+ global $DB;
|
58
|
68
|
$message = "";
|
59
|
69
|
if(!empty($_COOKIE['das-macaroon'])) {
|
60
|
70
|
try {
|
|
@@ -65,17 +75,17 @@ class auth_plugin_macaroons extends auth_plugin_base {
|
65
|
75
|
return !strcmp($a, "status = student");
|
66
|
76
|
}
|
67
|
77
|
]);
|
|
78
|
+
|
68
|
79
|
if($v->verify($m, "pocsecret")) {
|
69
|
80
|
$name = explode(";", $m->getIdentifier());
|
70
|
81
|
$username = join("", $name);
|
71
|
82
|
$user = authenticate_user_login($username, null);
|
72
|
83
|
|
73
|
|
-
|
74
|
84
|
if($user) {
|
75
|
85
|
$user->firstname = $name[0];
|
76
|
86
|
$user->lastname = $name[1];
|
77
|
87
|
$user->email = $username."@brendanabolivier.com";
|
78
|
|
-// var_dump($user);
|
|
88
|
+ // var_dump($user);
|
79
|
89
|
$DB->update_record('user', $user);
|
80
|
90
|
complete_user_login($user);
|
81
|
91
|
}
|
|
@@ -87,16 +97,6 @@ class auth_plugin_macaroons extends auth_plugin_base {
|
87
|
97
|
}
|
88
|
98
|
|
89
|
99
|
/**
|
90
|
|
- * Old syntax of class constructor. Deprecated in PHP7.
|
91
|
|
- *
|
92
|
|
- * @deprecated since Moodle 3.1
|
93
|
|
- */
|
94
|
|
- public function auth_plugin_macaroons() {
|
95
|
|
- debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
96
|
|
- self::__construct();
|
97
|
|
- }
|
98
|
|
-
|
99
|
|
- /**
|
100
|
100
|
* Returns true if the username and password work or don't exist and false
|
101
|
101
|
* if the user exists and the password is wrong.
|
102
|
102
|
*
|
|
@@ -105,12 +105,7 @@ 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
|
|
- global $message;
|
109
|
|
- if(!empty($message)) {
|
110
|
|
- return false;
|
111
|
|
- } elseif(!empty($_COOKIE['das-macaroon'])) {
|
112
|
|
- return true;
|
113
|
|
- }
|
|
108
|
+ return true;
|
114
|
109
|
}
|
115
|
110
|
|
116
|
111
|
/**
|