Skip to content

Commit

Permalink
handle the VPPA redirect situation
Browse files Browse the repository at this point in the history
  • Loading branch information
tamw-wnet committed Sep 20, 2024
1 parent a6aec9f commit dafcbf1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions templates/oauthcallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
$auth_client = $passport->get_laas_client();
}

$mvault_client = $passport->get_mvault_client();

$login_referrer = !empty($defaults['landing_page_url']) ? $defaults['landing_page_url'] : site_url();
if (!empty($_COOKIE["pbsoauth_login_referrer"])){
Expand Down Expand Up @@ -82,11 +83,21 @@
$code = $_GET["code"];
$userinfo = $auth_client->authenticate($code, $rememberme, $nonce, $code_verifier);
} else {
// only if VPPA redirect I think will there not be a 'code'
if ($use_pmsso) {
$userinfo = $auth_client->check_pmsso_login();
} else {
$userinfo = $auth_client->check_pbs_login();
}
// are they already activated?
if (isset($userinfo["pid"])) {
$mvaultinfo = $mvault_client->get_membership_by_uid($pbs_uid);
if (isset ($mvaultinfo["membership_id"])) {
$userinfo["membership_info"] = $mvaultinfo;
}
// create and update the userinfo cookie
$success = $auth_client->validate_and_append_userinfo($userinfo);
wp_redirect($login_referrer);
exit();
}
}
}

// now we either have userinfo or null.
Expand All @@ -95,7 +106,6 @@
$pbs_uid = $userinfo["pid"];

// now we work with the mvault
$mvault_client = $passport->get_mvault_client();
$mvaultinfo = array();
if ($membership_id) {
// this is an activation!
Expand Down

0 comments on commit dafcbf1

Please sign in to comment.