function _hybridauth_window_auth in HybridAuth Social Login 7.2
Same name and namespace in other branches
- 6.2 hybridauth.pages.inc \_hybridauth_window_auth()
1 call to _hybridauth_window_auth()
- hybridauth_window_start in ./hybridauth.pages.inc
File
- ./hybridauth.pages.inc, line 145
- HybridAuth module pages.
Code
function _hybridauth_window_auth($hybridauth, $provider_id) {
$error_code = NULL;
if (is_object($hybridauth)) {
$params = array(
'hauth_return_to' => url('hybridauth/window/' . $provider_id, array(
'absolute' => TRUE,
'query' => drupal_get_query_parameters(),
)),
);
if (isset($_GET['openid_identifier'])) {
$params['openid_identifier'] = $_GET['openid_identifier'];
}
try {
$adapter = $hybridauth
->authenticate($provider_id, $params);
$profile = (array) $adapter
->getUserProfile();
} catch (Exception $e) {
watchdog_exception('hybridauth', $e);
$error_code = $e
->getCode();
}
}
else {
$error_code = $hybridauth;
}
if (!is_null($error_code)) {
if (!user_is_logged_in()) {
$delete_session = TRUE;
foreach ($_SESSION as $key => $value) {
if (substr($key, 0, 4) != 'HA::') {
$delete_session = FALSE;
}
}
if ($delete_session) {
session_destroy();
}
}
switch ($error_code) {
case 5:
break;
case 0:
case 1:
case 2:
case 3:
case 4:
case 6:
case 7:
case 8:
default:
drupal_set_message(t('There was an error processing your request.'), 'error');
}
_hybridauth_window_close(FALSE);
}
$profile['provider'] = $provider_id;
drupal_alter('hybridauth_profile', $profile);
return _hybridauth_window_process_auth($profile);
}