We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ed141e0 commit e8d53f8Copy full SHA for e8d53f8
auth.php
@@ -146,6 +146,11 @@ private function attempt_jwt_login() {
146
147
if (!$userExists) {
148
149
+ $preventAutoUserCreation = $this->prevent_auto_user_creation();
150
+ if ($preventAutoUserCreation) {
151
+ return;
152
+ }
153
+
154
$username = $this->get_expected_username($payload);
155
$password = null;
156
@@ -361,6 +366,10 @@ private function decode_base_64($encodedStr) {
361
366
return base64_decode($b);
362
367
}
363
368
369
+ private function prevent_auto_user_creation() {
370
+ return $this->has_env_bool("MOODLE_JWT_PREVENT_AUTO_USER_CREATION");
371
372
364
373
private function has_env_bool($variableName) {
365
374
$value = getenv($variableName);
375
$exists = $value != false;
0 commit comments