/* Decoded by unphp.net */ render_test_config_output($Kx, false); if (!(!isset($FX["groupdetailsurl"]) || '' === $FX["groupdetailsurl"])) { goto vs; } return; vs: $IQ = []; $pL = $FX["groupdetailsurl"]; if (!(strpos($pL, "api.clever.com") != false && isset($Kx["data"]["id"]))) { goto Dw; } $pL = str_replace("userid", $Kx["data"]["id"], $pL); Dw: MO_Oauth_Debug::mo_oauth_log("Group Details URL: " . $pL); if (!('' === $Ah)) { goto LM; } if (has_filter("mo_oauth_cfa_group_details")) { goto Qv; } MO_Oauth_Debug::mo_oauth_log("Access Token Empty"); return; Qv: LM: if (!('' !== $pL)) { goto uW; } if (has_filter("mo_oauth_cfa_group_details")) { goto rB; } if (has_filter("mo_oauth_group_details")) { goto T4; } if (has_filter("mo_oauth_raven_group_details")) { goto dR; } if (has_filter("mo_oauth_noviams_group_details")) { goto LC; } $IQ = $this->oauth_handler->get_resource_owner($pL, $Ah); goto Uw; LC: $IQ = apply_filters("mo_oauth_noviams_group_details", $Kx, $pL); Uw: goto dV; dR: $IQ = apply_filters("mo_oauth_raven_group_details", $Kx["email"], $pL, $Ah, $FX, $i1); dV: goto W_; T4: $IQ = apply_filters("mo_oauth_group_details", $pL, $Ah, $FX, $i1); W_: goto BC; rB: MO_Oauth_Debug::mo_oauth_log("Fetching CFA Group.."); $IQ = apply_filters("mo_oauth_cfa_group_details", $Kx, $pL, $Ah, $FX, $i1); BC: MO_Oauth_Debug::mo_oauth_log("Group Details => "); MO_Oauth_Debug::mo_oauth_log($IQ); $ff = $H0->mo_oauth_client_get_option("mo_oauth_attr_name_list" . $FX["appId"]); $ty = []; $U1 = $this->dropdownattrmapping('', $IQ, $ty); $ff = (array) $ff + $U1; $H0->mo_oauth_client_update_option("mo_oauth_attr_name_list" . $FX["appId"], $ff); if (!($MU && '' !== $MU)) { goto xV; } if (!(is_array($IQ) && !empty($IQ))) { goto oM; } $this->render_test_config_output($IQ, true); oM: return; xV: uW: } public function handle_group_user_info($Kx, $FX, $Ah) { MO_Oauth_Debug::mo_oauth_log("Group user endpoint configured."); if (!(!isset($FX["groupdetailsurl"]) || '' === $FX["groupdetailsurl"])) { goto x7; } return $Kx; x7: $pL = $FX["groupdetailsurl"]; if (!(strpos($pL, "api.clever.com") != false && isset($Kx["data"]["id"]))) { goto AH; } $pL = str_replace("userid", $Kx["data"]["id"], $pL); AH: if (!('' === $Ah)) { goto Wu; } return $Kx; Wu: $IQ = array(); if (!('' !== $pL)) { goto Wm; } if (has_filter("mo_oauth_cfa_group_details")) { goto WU; } if (has_filter("mo_oauth_group_details")) { goto Nu; } if (has_filter("mo_oauth_raven_group_details")) { goto sH; } if (has_filter("mo_oauth_noviams_group_details")) { goto my; } $IQ = $this->oauth_handler->get_resource_owner($pL, $Ah); goto j2; my: $IQ = apply_filters("mo_oauth_noviams_group_details", $Kx, $pL); j2: goto u2; sH: $IQ = apply_filters("mo_oauth_raven_group_details", $Kx["email"], $pL, $Ah, $FX, $i1); u2: goto Vp; Nu: $IQ = apply_filters("mo_oauth_group_details", $pL, $Ah, $FX); Vp: goto iG; WU: MO_Oauth_Debug::mo_oauth_log("Fetching CFA Group.."); $IQ = apply_filters("mo_oauth_cfa_group_details", $Kx, $pL, $Ah, $FX, $i1); iG: Wm: MO_Oauth_Debug::mo_oauth_log("Group Details => "); MO_Oauth_Debug::mo_oauth_log($IQ); if (!(is_array($IQ) && count($IQ) > 0)) { goto rf; } $Kx = array_merge($Kx, $IQ); rf: MO_Oauth_Debug::mo_oauth_log("Resource Owner After merging with Group detials => "); MO_Oauth_Debug::mo_oauth_log($Kx); return $Kx; } public function mo_oauth_client_map_default_role($o_, $FX) { MO_Oauth_Debug::mo_oauth_log("Only default role mapped"); $jK = new \WP_User($o_); if (!(isset($FX["enable_role_mapping"]) && !boolval($FX["enable_role_mapping"]))) { goto Fm; } $jK->set_role(''); return; Fm: if (!(isset($FX["_mapping_value_default"]) && '' !== $FX["_mapping_value_default"])) { goto AF; } $CT = explode(",", $FX["_mapping_value_default"]); $mQ = 0; foreach ($CT as $nK) { if (!(0 === $mQ)) { goto jC; } $jK->set_role(''); jC: $nK = trim($nK); $jK->add_role($nK); $mQ++; Tq: } yT: AF: } public function handle_sso($Hr, $FX, $Kx, $Wh, $k0, $aV = false) { global $H0; $aQ = new StorageManager($Wh); do_action("mo_oauth_link_discord_account", $aQ, $Kx); $EN = isset($FX["username_attr"]) ? $FX["username_attr"] : ''; $wu = isset($FX["email_attr"]) ? $FX["email_attr"] : ''; $nZ = isset($FX["firstname_attr"]) ? $FX["firstname_attr"] : ''; $pJ = isset($FX["lastname_attr"]) ? $FX["lastname_attr"] : ''; $DN = isset($FX["display_attr"]) ? $FX["display_attr"] : ''; $Eb = $H0->getnestedattribute($Kx, $EN); $U2 = $H0->getnestedattribute($Kx, $wu); $ZA = $H0->getnestedattribute($Kx, $nZ); $r3 = $H0->getnestedattribute($Kx, $pJ); $GD = $Eb; $this->config = $H0->mo_oauth_client_get_option("mo_oauth_client_config"); $this->config = !$this->config || empty($this->config) ? array() : $this->config->get_current_config(); $xi = isset($this->config["activate_user_analytics"]) ? $this->config["activate_user_analytics"] : 0; $current_user = wp_get_current_user(); if (!($current_user->ID !== 0)) { goto xv; } do_action("mo_oauth_discord_flow_handle", $current_user, $k0, $Kx); do_action("mo_oauth_logged_in_user_tag_update", $current_user, $k0, $Kx); $Cl = get_option("mo_drm_sync_redirect"); if (!(isset($Cl) && $Cl)) { goto zE; } wp_redirect($Cl); exit; zE: xv: if (empty($DN)) { goto Rp; } switch ($DN) { case "FNAME": $GD = $ZA; goto rW; case "LNAME": $GD = $r3; goto rW; case "USERNAME": $GD = $Eb; goto rW; case "FNAME_LNAME": $GD = $ZA . " " . $r3; goto rW; case "LNAME_FNAME": $GD = $r3 . " " . $ZA; default: goto rW; } GJ: rW: Rp: if (!empty($Eb)) { goto RW; } MO_Oauth_Debug::mo_oauth_log("Username : " . $Eb); $this->check_status(array("msg" => "Username not received. Check your Attribute Mapping configuration.", "code" => "UNAME", "status" => false, "application" => $Hr, "email" => '', "username" => ''), $xi); RW: if (!(!empty($U2) && false === strpos($U2, "@"))) { goto TO; } $this->check_status(array("msg" => "Mapped Email attribute does not contain valid email.", "code" => "EMAIL", "status" => false, "application" => $Hr, "client_ip" => $H0->get_client_ip(), "email" => $U2, "username" => $Eb), $xi); TO: if (!is_multisite()) { goto D0; } $blog_id = $aQ->get_value("blog_id"); switch_to_blog($blog_id); do_action("mo_oauth_client_concord_restrict_login", $FX, $Kx, $blog_id); D0: if (!has_action("mo_oauth_client_save_user_in_session")) { goto v3; } do_action("mo_oauth_client_save_user_in_session", array("app_config" => $FX, "storage_manager" => $aQ, "resource_owner" => $Kx, "username" => $Eb)); v3: do_action("mo_oauth_restrict_emails", $U2, $this->config); if (!has_filter("mo_oauth_modify_username_attr")) { goto pu; } $Eb = apply_filters("mo_oauth_modify_username_attr", $Kx); pu: if (!has_filter("mo_oauth_check_user_authorised")) { goto rM; } $Eb = apply_filters("mo_oauth_check_user_authorised", $Kx, $Eb); rM: $user = get_user_by("login", $Eb); $fB = isset($FX["allow_duplicate_emails"]) ? true : false; if ($user) { goto F0; } if (!(!$fB || $fB && !$FX["allow_duplicate_emails"])) { goto VH; } $user = get_user_by("email", $U2); VH: F0: $o_ = $user ? $user->ID : 0; $Sx = 0 === $o_; if (!has_filter("mo_oauth_get_user_by_email")) { goto n_; } $user = apply_filters("mo_oauth_get_user_by_email", $Eb, $U2); n_: if (!has_filter("mo_oauth_check_user_by_email")) { goto k8; } $Sx = apply_filters("mo_oauth_check_user_by_email", $Eb, $U2); k8: $o_ = $user ? $user->ID : 0; if (!(isset($FX["autocreateusers"]) && 1 !== intval($FX["autocreateusers"]))) { goto I9; } $blog_id = 1; $Um = apply_filters("mo_oauth_client_disable_auto_create_users_for_specific_idp", $o_, $blog_id, $this->config, $FX); $this->config = $Um[0]; $FX = $Um[1]; I9: if (!(!(isset($this->config["auto_register"]) && 1 === intval($this->config["auto_register"])) && $Sx)) { goto IE; } MO_Oauth_Debug::mo_oauth_log("Registration is disabled for this site. Please check Auto register user settings. "); $this->check_status(array("msg" => "Registration is disabled for this site. Please contact your administrator", "code" => "REGISTRATION_DISABLED", "status" => false, "application" => $Hr, "client_ip" => $H0->get_client_ip(), "email" => $U2, "username" => $Eb), $xi); IE: if (!$Sx) { goto Ry; } $E5 = 10; $Hw = false; $eM = false; $mA = apply_filters("mo_oauth_password_policy_manager", $E5); if (!is_array($mA)) { goto kb; } $E5 = intval($mA["password_length"]); $Hw = $mA["special_characters"]; $eM = $mA["extra_special_characters"]; kb: $Og = wp_generate_password($E5, $Hw, $eM); $Sh = get_user_by("email", $U2); if (!$Sh) { goto BY; } add_filter("pre_user_email", array($this, "skip_email_exist"), 30); BY: $Eb = apply_filters("mo_oauth_get_username_with_postfix_added", $Eb, $U2); $o_ = wp_create_user($Eb, $Og, $U2); if (!is_wp_error($o_)) { goto Mw; } MO_Oauth_Debug::mo_oauth_log("Error creating WP user"); wp_die("Error: Username contains special characters. Please contact your administrator."); goto Rn; Mw: MO_Oauth_Debug::mo_oauth_log("New user created =>"); MO_Oauth_Debug::mo_oauth_log("User ID => " . $o_); Rn: $eB = array("ID" => $o_, "user_email" => $U2, "user_login" => $Eb, "user_nicename" => $Eb); do_action("user_register", $o_, $eB); Ry: if (!($Sx || (!isset($this->config["keep_existing_users"]) || 1 !== intval($this->config["keep_existing_users"])))) { goto lV; } if (!is_wp_error($o_)) { goto LS; } if (!get_user_by("login", $Eb)) { goto je; } $o_ = get_user_by("login", $Eb)->ID; je: LS: $Iv = array("ID" => $o_, "first_name" => $ZA, "last_name" => $r3, "display_name" => $GD, "user_login" => $Eb, "user_nicename" => $Eb); if (isset($this->config["keep_existing_email_attr"]) && 1 === intval($this->config["keep_existing_email_attr"])) { goto iB; } $Iv["user_email"] = $U2; wp_update_user($Iv); MO_Oauth_Debug::mo_oauth_log("Attribute Mapping Done"); goto lr; iB: wp_update_user($Iv); MO_Oauth_Debug::mo_oauth_log("Attribute Mapping updated except email."); lr: if (!isset($Kx["sub"])) { goto MJ; } update_user_meta($o_, "mo_backchannel_attr_sub", $Kx["sub"]); MJ: if (!isset($Kx["sid"])) { goto j8; } update_user_meta($o_, "mo_backchannel_attr_sid", $Kx["sid"]); j8: update_user_meta($o_, "mo_oauth_buddypress_attributes", $Kx); MO_Oauth_Debug::mo_oauth_log("BuddyPress attributes updated successfully"); lV: $user = get_user_by("ID", $o_); MO_Oauth_Debug::mo_oauth_log("User Found"); MO_Oauth_Debug::mo_oauth_log("User ID => " . $o_); $Hp = $H0->is_multisite_plan(); if (!is_multisite()) { goto U9; } MO_Oauth_Debug::mo_oauth_log("Multisite Plan"); $EG = $H0->mo_oauth_client_get_option("mo_oauth_c3Vic2l0ZXNzZWxlY3RlZA"); $Gx = array(); if (!isset($EG)) { goto wy; } $Gx = json_decode($H0->mooauthdecrypt($EG), true); wy: $M0 = false; if (!(is_array($Gx) && in_array($blog_id, $Gx))) { goto Iu; } $M0 = true; Iu: $fT = intval($H0->mo_oauth_client_get_option("noOfSubSites")); $In = get_sites(["number" => 1000]); if (!(is_multisite() && $Hp && ($Hp && !$M0 && $fT < 1000))) { goto A0; } $oC = "You have not upgraded to the correct license plan. Either you have purchased for incorrect no. of sites or you have created a new subsite. Contact to your administrator to upgrade your subsite."; MO_Oauth_Debug::mo_oauth_log($oC); $H0->handle_error($oC); wp_die($oC); A0: U9: if ($user) { goto Xk; } return; Xk: $p0 = ''; if (isset($this->config["after_login_url"]) && '' !== $this->config["after_login_url"]) { goto J4; } $Qg = $aQ->get_value("redirect_uri"); $vN = parse_url($Qg); MO_Oauth_Debug::mo_oauth_log("Redirect Url components =>"); MO_Oauth_Debug::mo_oauth_log($vN); if (!(isset($vN["path"]) && strpos($vN["path"], "wp-login.php") !== false)) { goto bx; } $Qg = site_url(); bx: if (!isset($vN["query"])) { goto jv; } parse_str($vN["query"], $zS); if (!isset($zS["redirect_to"])) { goto B3; } $Qg = $zS["redirect_to"]; B3: jv: $p0 = rawurldecode($Qg && '' !== $Qg ? $Qg : site_url()); MO_Oauth_Debug::mo_oauth_log("Custom URL after login default =>" . $p0); $V6 = isset($this->config["whitelist_redirect_url"]) ? $this->config["whitelist_redirect_url"] : ''; $M0 = false; $SW = isset($this->config["whitelist_redirect_urls"]) ? $this->config["whitelist_redirect_urls"] : ''; if (!(!empty($SW) && isset($SW) && isset($V6) && !empty($V6))) { goto qF; } $dq = explode(";", $SW); MO_Oauth_Debug::mo_oauth_log("Whitelist Redirect Urls =>"); MO_Oauth_Debug::mo_oauth_log($dq); $p0 = strtolower($p0); $p0 = trim(trim($p0), "/"); MO_Oauth_Debug::mo_oauth_log("SSO Redirect Url=>"); MO_Oauth_Debug::mo_oauth_log($p0); foreach ($dq as $cW) { $cW = strtolower($cW); if (!ctype_space(substr($cW, -1))) { goto rI; } $cW = substr_replace($cW, '', -1); rI: $cW = trim(trim($cW), "/"); if (!(substr($cW, -1) == "*")) { goto y2; } $cW = substr_replace($cW, '', -1); $cW = trim($cW, "/"); if (!(strpos($p0, $cW) !== false)) { goto cM; } $M0 = true; goto Lk; cM: y2: if (!(strcmp($p0, $cW) == 0)) { goto ZC; } $M0 = true; goto Lk; ZC: nF: } Lk: if ($M0) { goto pK; } $p0 = home_url(); pK: qF: if (!(strpos($p0, "mo_change_to_hash") !== false)) { goto ob; } $p0 = str_replace("mo_change_to_hash", "#", $p0); ob: if (!has_filter("mo_oauth_dis_update_actual_link")) { goto mN; } $p0 = apply_filters("mo_oauth_dis_update_actual_link", $p0, $Eb); mN: goto KO; J4: $p0 = $this->config["after_login_url"]; MO_Oauth_Debug::mo_oauth_log("Custom URL after login configured. =>" . $p0); KO: if (!($H0->get_versi() === 1)) { goto ZI; } if (isset($FX["enable_role_mapping"])) { goto ex; } $FX["enable_role_mapping"] = true; if (!(isset($FX["client_creds_encrpyted"]) && boolval($FX["client_creds_encrpyted"]))) { goto SS; } $FX["client_id"] = $H0->mooauthencrypt($FX["client_id"]); $FX["client_secret"] = $H0->mooauthencrypt($FX["client_secret"]); SS: $H0->set_app_by_name($F3["app_name"], $FX); ex: if (!(!user_can($o_, "administrator") && $Sx || !isset($FX["keep_existing_user_roles"]) || 1 !== intval($FX["keep_existing_user_roles"]))) { goto ZE; } $this->mo_oauth_client_map_default_role($o_, $FX); MO_Oauth_Debug::mo_oauth_log("Role Mapping Done"); ZE: ZI: do_action("mo_oauth_client_map_roles", array("user_id" => $o_, "app_config" => $FX, "new_user" => $Sx, "resource_owner" => $Kx, "app_name" => $Hr, "config" => $this->config)); MO_Oauth_Debug::mo_oauth_log("Role Mapping Done"); do_action("mo_oauth_logged_in_user_token", $user, $k0); do_action("mo_oauth_add_dis_user_server", $o_, $k0, $Kx); $this->check_status(array("msg" => "Login Successful!", "code" => "LOGIN_SUCCESS", "status" => true, "application" => $Hr, "client_ip" => $H0->get_client_ip(), "navigationurl" => $p0, "email" => $U2, "username" => $Eb), $xi); if (!$aV) { goto K2; } return $user; K2: do_action("mo_oauth_set_login_cookie"); do_action("mo_oauth_get_user_attrs", $user, $Kx); update_user_meta($user->ID, "mo_oauth_client_last_id_token", isset($k0["id_token"]) ? $k0["id_token"] : $k0["access_token"]); wp_set_current_user($user->ID); $J2 = false; $J2 = apply_filters("mo_remember_me", $J2); wp_set_auth_cookie($user->ID, $J2); MO_Oauth_Debug::mo_oauth_log("WP OAuth cookie setted."); if (!isset($Kx["roles"])) { goto p1; } apply_filters("mo_oauth_update_bbp_role", $user->ID, $Kx["roles"]); p1: if (!has_action("mo_hack_login_session_redirect")) { goto OA; } $qp = $H0->gen_rand_str(); $SF = $H0->gen_rand_str(); $mA = array("user_id" => $user->ID, "user_password" => $SF); set_transient($qp, $mA); do_action("mo_hack_login_session_redirect", $user, $SF, $qp, $p0); OA: do_action("wp_login", $user->user_login, $user); MO_Oauth_Debug::mo_oauth_log("User logged in"); setcookie("mo_oauth_login_app_session", $Hr, time() + 120, "/", null, true, true); do_action("mo_oauth_get_token_for_headless", $user, $k0, $p0); do_action("mo_oauth_get_current_appname", $Hr); $Be = $aQ->get_value("restrictredirect") !== false; $QX = $aQ->get_value("popup") === "ignore"; if (isset($this->config["popup_login"]) && 1 === intval($this->config["popup_login"]) && !$QX && !boolval($Be)) { goto Wc; } do_action("mo_oauth_redirect_oauth_users", $user, $p0); MO_Oauth_Debug::mo_oauth_log("User redirected to =>" . $p0); wp_redirect($p0); goto Ke; Wc: MO_Oauth_Debug::mo_oauth_log("Opened login window in popup."); if (!has_filter("mo_oauth_redirect_oauth_users")) { goto G3; } $p0 = apply_filters("mo_oauth_redirect_oauth_users", $user, $p0); G3: MO_Oauth_Debug::mo_oauth_log("User redirected to =>" . $p0); echo ""; Ke: exit; } public function check_status($F3, $xi) { global $H0; if (isset($F3["status"])) { goto YM; } MO_Oauth_Debug::mo_oauth_log("Something went wrong. Please try Logging in again."); $H0->handle_error("Something went wrong. Please try Logging in again."); wp_die(wp_kses("Something went wrong. Please try Logging in again.", \mo_oauth_get_valid_html())); YM: if (!(isset($F3["status"]) && true === $F3["status"] && (isset($F3["code"]) && "LOGIN_SUCCESS" === $F3["code"]))) { goto Rx; } return true; Rx: if (!(true !== $F3["status"])) { goto Bt; } $t0 = isset($F3["msg"]) && !empty($F3["msg"]) ? $F3["msg"] : "Something went wrong. Please try Logging in again."; MO_Oauth_Debug::mo_oauth_log($t0); $H0->handle_error($t0); wp_die(wp_kses($t0, \mo_oauth_get_valid_html())); exit; Bt: } public function skip_email_exist($Ak) { define("WP_IMPORTING", "SKIP_EMAIL_EXIST"); return $Ak; } } ?>