$response = ApiCaller::call($r); if ($response["status"] === "error") { if ($response["errorcode"] === 600 || $response["errorcode"] === 601) { $emailVerified = false; } } $triedToLogin = true; } if (isset($_GET["state"])) { $c_Session->LoginViaFacebook(); $triedToLogin = true; } if (isset($_GET["shva"])) { $triedToLogin = true; } if ($c_Session->CurrentSessionAvailable()) { if (isset($_GET['redirect'])) { die(header('Location: ' . $_GET['redirect'])); } else { die(header('Location: /profile/')); } } else { if ($triedToLogin) { if (isset($response["error"])) { $smarty->assign('ERROR_TO_USER', 'NATIVE_LOGIN_FAILED'); $smarty->assign('ERROR_MESSAGE', $response["error"]); } else { $smarty->assign('ERROR_TO_USER', 'THIRD_PARTY_LOGIN_FAILED'); $smarty->assign('ERROR_MESSAGE', $smarty->getconfigvars('loginFederatedFailed')); } }