Skip to content

Commit

Permalink
MDL-58905 auth_oauth2: Add plugin enabled checkings
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed May 12, 2017
1 parent 011591a commit ac8a0c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions auth/oauth2/confirm-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@

$auth = get_auth_plugin('oauth2');

if (!\auth_oauth2\api::is_enabled()) {
throw new \moodle_exception('notenabled', 'auth_oauth2');
}

$confirmed = $auth->user_confirm($username, $usersecret);

if ($confirmed == AUTH_CONFIRM_ALREADY) {
Expand Down
4 changes: 4 additions & 0 deletions auth/oauth2/confirm-linkedlogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
$PAGE->set_url('/auth/oauth2/confirm-linkedlogin.php');
$PAGE->set_context(context_system::instance());

if (!\auth_oauth2\api::is_enabled()) {
throw new \moodle_exception('notenabled', 'auth_oauth2');
}

$confirmed = \auth_oauth2\api::confirm_link_login($userid, $username, $issuerid, $token);

if ($confirmed) {
Expand Down
4 changes: 4 additions & 0 deletions auth/oauth2/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@

require_sesskey();

if (!\auth_oauth2\api::is_enabled()) {
throw new \moodle_exception('notenabled', 'auth_oauth2');
}

$issuer = new \core\oauth2\issuer($issuerid);

$returnparams = ['wantsurl' => $wantsurl, 'sesskey' => sesskey(), 'id' => $issuerid];
Expand Down

0 comments on commit ac8a0c4

Please sign in to comment.