Exemplo n.º 1
0
    }
    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);
    Tygh::$app['view']->assign('view_mode', 'simple');
} elseif ($mode == 'specify_email') {
    if (!empty($_REQUEST['user_email'])) {
        fn_hybrid_auth_process('login_provider', $redirect_url);
        $_REQUEST['redirect_url'] = $redirect_url;
        return array(CONTROLLER_STATUS_REDIRECT, fn_url($redirect_url));
    }
    $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 (AREA != 'A') {
        fn_add_breadcrumb(__('hybrid_auth.specify_email'));
    }
    Tygh::$app['view']->assign('identifier', $identifier);
    Tygh::$app['view']->assign('provider', $provider);
    Tygh::$app['view']->assign('redirect_url', $redirect_url);
    Tygh::$app['view']->assign('view_mode', 'simple');
}
Exemplo n.º 2
0
    $providers_list = fn_hybrid_auth_get_providers_list();
    Tygh::$app['view']->assign('providers_list', $providers_list);
    $linked_providers = array();
    if (!empty($auth['user_id'])) {
        $linked_providers = fn_hybrid_auth_get_link_provider($auth['user_id']);
    }
    Tygh::$app['view']->assign('linked_providers', $linked_providers);
} elseif ($mode == 'unlink_provider') {
    if (defined('AJAX_REQUEST')) {
        if (!empty($auth['user_id']) && !empty($_REQUEST['provider'])) {
            fn_hybrid_auth_get_unlink_provider($auth['user_id'], $_REQUEST['provider']);
        }
        $providers_list = fn_hybrid_auth_get_providers_list();
        Tygh::$app['view']->assign('providers_list', $providers_list);
        if (!empty($auth['user_id'])) {
            $linked_providers = fn_hybrid_auth_get_link_provider($auth['user_id']);
            Tygh::$app['view']->assign('linked_providers', $linked_providers);
        }
        Tygh::$app['view']->display('views/profiles/update.tpl');
    }
    exit;
} elseif ($mode == 'link_provider') {
    $status = fn_hybrid_auth_process('link_provider_profile', $redirect_url);
    if ($status == HYBRID_AUTH_LOADING) {
        Tygh::$app['view']->display('addons/hybrid_auth/views/auth/loading.tpl');
    } else {
        Tygh::$app['view']->assign('redirect_url', fn_url($redirect_url));
        Tygh::$app['view']->display('addons/hybrid_auth/views/auth/login_error.tpl');
    }
    exit;
}