You should probably keep the exit code if the user is already logged in.
I think you can dynamically alter the return value, but I can’t say exactly how. I think it has to do with setting
$_POST['return'] = $url;
but you’d need to test that to be sure