So i am adding this to an existing script, which also uses sessions. I am going to make a workaround so the login is bypassed automatically by sending the existing session data to the task freak login.
I changed
$pJSonLoad .= 'document.forms[0].username.focus();';
to
$pJSonLoad .= 'document.forms[0].username.focus(); document.loginForm.submit();';
and added
name="loginForm"
to the form to auto send the login, which i changed the
$_REQUEST['username']
to
$_SESSION['userdata']['username']
So basically it sends the logged in users username which i have sync'ed with the task freak database. Now since i dont have the passwords i didn't change that one and i hit refresh. It tried to login with some prefilled password (Chrome) and said "Login Failed" but here is the catch, after about 25 tries (since it is a on page load loop), it logged me in.
You may want to take a look at how the login process works with existing sessions on the domain name it is being added to.