Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
vm.challengeType = challengeType;
vm.siteURL = siteURL;

vm.isLoggedIn = typeof $cookies.tcjwt !== 'undefined' && typeof $cookies.tcsso !== 'undefined';
vm.isLoggedIn = typeof $cookies.tcjwt !== 'undefined';
vm.delayAction = typeof $cookies.tcDelayChallengeAction !== 'undefined';
if (vm.delayAction) {
vm.tcDoAction = $cookies.tcDelayChallengeAction.split('|');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ $(document).ready(function () {
// init tab nav
app.tabNavinit();

var tcsso = getCookie('tcsso');
var tcjwt = getCookie('tcjwt');

});
Expand Down
2 changes: 1 addition & 1 deletion src/js/app/my-dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
p {
margin: initial;
}
div.userPic, div.userDetails {
div.userPic, div.userDetails, div.userWidget {
box-sizing: initial;
}
a {
Expand Down
11 changes: 4 additions & 7 deletions src/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,19 @@ var app = {
$('body').addClass('ie7');
ie7 = true;
}
// expiry date for tcjwt and tcsso cookies extended 1 year if rememberme true
// expiry date for tcjwt cookie extended 1 year if rememberme true
if ($.cookie('rememberMe')) {
$.cookie.raw = true;
var tcjwt = $.cookie('tcjwt');
var tcsso = $.cookie('tcsso');
if ((typeof tcjwt != 'undefined') && (typeof tcsso != 'undefined')) {
if ((typeof tcjwt != 'undefined')) {
var cookieConfig = {
expires: 365,
path: '/',
domain: '.topcoder.com'
};
$.cookie('tcjwt', tcjwt, cookieConfig);
$.cookie('tcsso', tcsso, cookieConfig);
} else {
// if tcjwt and tcsso not present remove rememberme
// if tcjwt not present remove rememberme
$.removeCookie('rememberMe');
}
}
Expand Down Expand Up @@ -1710,9 +1708,8 @@ var app = {

isLoggedIn: function() {
var tcjwt = $.cookie('tcjwt');
var tcsso = $.cookie('tcsso');

if (typeof tcjwt == "undefined" || typeof tcsso == "undefined") {
if (typeof tcjwt == "undefined") {
return false;
}

Expand Down
60 changes: 0 additions & 60 deletions wp/wp-content/plugins/TcApi-hookup/includes/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,66 +34,6 @@

<body>

<?php
$nav = array (
'menu' => 'Main Navigation',
'menu_class' => '',
'container' => '',
'menu_class' => 'root',
'items_wrap' => '%3$s',
'walker' => new nav_menu_walker ()
);

// Print a cookie
//echo $_COOKIE["tcsso"];

//Get the TopCoder SSO Cookie
$cookie = $_COOKIE["tcsso"];
$cookie_parts = explode( "|", $cookie);
$user_id = $cookie_parts[0];
$tc_token = $cookie_parts[1];
#$user_id = "22760600";

// PEMULA - update this to correctly parts the "handle" from the json and set it to $handle
$url = "https://community.topcoder.com/tc?module=BasicData&c=get_handle_by_id&dsid=30&uid=".$user_id."&json=true";
$response = get_json_from_url ( $url );
#print_r($response);
// print_r( json_decode ( $response )->data[0]->handle );

// if (is_wp_error ( $response ) || ! isset ( $response ['data'] )) {
// return "Error in processing";
// }
//$handle_obj = json_decode ( $response ['data'], true);
//echo print_r ($handle_obj);
//print_r($handle_obj->{'handle'});

$handle = json_decode ( $response )->data[0]->handle; //Replace this with a call to http://community.topcoder.com/tc?module=BasicData&c=get_handle_by_id&dsid=30&uid=8547899&json=true and parse the handle from the result.

if ( isset($_COOKIE["user"]) )
{
$user = $handle;
$welcome = "hide";
$reg = "";
}
else
{
$user = "newUser";
$welcome = "";
$reg = "hide";
}

global $coder;
$coder = get_raw_coder($handle);
$memberSince = explode(" ",$coder->memberSince);
$memberSince = explode(".",$memberSince[0]);
$memberEarning = '$'.$coder->overallEarning;
if ( $coder->photoLink != '')
$photoLink = 'http://community.topcoder.com'.$coder->photoLink;
else
$photoLink = 'http://community.topcoder.com/i/m/nophoto_login.gif';

?>

<div id="wrapper">
<nav class="sidebarNav mainNav onMobi <?php echo $user; ?>">
<ul class="root"><?php wp_nav_menu ( $nav ); ?>
Expand Down
1 change: 0 additions & 1 deletion wp/wp-content/themes/tcs-responsive/page-referral.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
if ( $('#referralText').length>0 ) {
var tcjwt = $.cookie('tcjwt');
if (tcjwt) {
var tcssoValues = tcsso.split("|");
var handle = '';

$.ajax({type: "GET", url: tcApiRUL + '/user/identity', dataType: 'json', headers: {'Authorization': 'Bearer ' + tcjwt}, function(data) {
Expand Down