function fn_hybrid_auth_link_profile($auth_data, $provider) { if (!fn_hybrid_auth_is_exist($auth_data)) { if (!empty($_SESSION['auth']['user_id'])) { fn_hybrid_auth_link_provider($_SESSION['auth']['user_id'], $auth_data->identifier, $provider); } } else { fn_set_notification('W', __('notice'), __("text_hybrid_auth.user_is_already_link")); } $redirect_url = !empty($_REQUEST['return_url']) ? $_REQUEST['return_url'] : fn_url('profiles.update'); return $redirect_url; }
Hybrid_Endpoint::process(); } elseif ($mode == 'login_form') { $providers_list = fn_hybrid_auth_get_providers_list(); if (!empty($providers_list)) { Tygh::$app['view']->assign('providers_list', $providers_list); } } elseif ($mode == 'logout') { // Remove Hybrid auth data unset($_SESSION['HA::CONFIG'], $_SESSION['HA::STORE']); } elseif ($mode == 'connect_social') { $email = !empty($_SESSION['hybrid_auth']['email']) ? $_SESSION['hybrid_auth']['email'] : ''; $identifier = !empty($_SESSION['hybrid_auth']['identifier']) ? $_SESSION['hybrid_auth']['identifier'] : ''; $provider = !empty($_SESSION['hybrid_auth']['provider']) ? $_SESSION['hybrid_auth']['provider'] : ''; $redirect_url = !empty($_SESSION['hybrid_auth']['redirect_url']) ? $_SESSION['hybrid_auth']['redirect_url'] : fn_url(); if (!empty($_SESSION['auth']['user_id'])) { fn_hybrid_auth_link_provider($_SESSION['auth']['user_id'], $identifier, $provider); unset($_SESSION['hybrid_auth']); return array(CONTROLLER_STATUS_REDIRECT, $redirect_url); } if (AREA != 'A') { fn_add_breadcrumb(__('hybrid_auth.connect_social')); } $user_id = fn_is_user_exists(0, array('email' => $email)); if (!empty($user_id)) { $user_data = fn_get_user_short_info($user_id); $user_login = $user_data['email']; } else { $user_login = ''; } Tygh::$app['view']->assign('user_login', $user_login); Tygh::$app['view']->assign('identifier', $identifier);
Hybrid_Endpoint::process(); } elseif ($mode == 'login_form') { $providers_list = fn_hybrid_auth_get_providers_list(); if (!empty($providers_list)) { Tygh::$app['view']->assign('providers_list', $providers_list); } } elseif ($mode == 'logout') { // Remove Hybrid auth data unset(Tygh::$app['session']['HA::CONFIG'], Tygh::$app['session']['HA::STORE']); } elseif ($mode == 'connect_social') { $email = !empty(Tygh::$app['session']['hybrid_auth']['email']) ? Tygh::$app['session']['hybrid_auth']['email'] : ''; $identifier = !empty(Tygh::$app['session']['hybrid_auth']['identifier']) ? Tygh::$app['session']['hybrid_auth']['identifier'] : ''; $provider = !empty(Tygh::$app['session']['hybrid_auth']['provider']) ? Tygh::$app['session']['hybrid_auth']['provider'] : ''; $redirect_url = !empty(Tygh::$app['session']['hybrid_auth']['redirect_url']) ? Tygh::$app['session']['hybrid_auth']['redirect_url'] : fn_url(); if (!empty(Tygh::$app['session']['auth']['user_id'])) { fn_hybrid_auth_link_provider(Tygh::$app['session']['auth']['user_id'], $identifier, $provider); unset(Tygh::$app['session']['hybrid_auth']); return array(CONTROLLER_STATUS_REDIRECT, $redirect_url); } if (AREA != 'A') { fn_add_breadcrumb(__('hybrid_auth.connect_social')); } $user_id = fn_is_user_exists(0, array('email' => $email)); if (!empty($user_id)) { $user_data = fn_get_user_short_info($user_id); $user_login = $user_data['email']; } else { $user_login = ''; } Tygh::$app['view']->assign('user_login', $user_login); Tygh::$app['view']->assign('identifier', $identifier);