diff options
author | tailor <cygnus@janrain.com> | 2007-03-06 20:03:48 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2007-03-06 20:03:48 +0000 |
commit | 478a44dbc0d4f0d4a371501c3ffbe37d9bfd89a5 (patch) | |
tree | 850b6776410065ebdb4f61f6f5c4033110421ba8 /examples/consumer/try_auth.php | |
parent | 9b8040d7bea9daa4c2d9360e77870a26dca38947 (diff) | |
download | php-openid-478a44dbc0d4f0d4a371501c3ffbe37d9bfd89a5.zip php-openid-478a44dbc0d4f0d4a371501c3ffbe37d9bfd89a5.tar.gz php-openid-478a44dbc0d4f0d4a371501c3ffbe37d9bfd89a5.tar.bz2 |
[project @ Make example consumer send redirect or use form markup]
Diffstat (limited to 'examples/consumer/try_auth.php')
-rw-r--r-- | examples/consumer/try_auth.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/examples/consumer/try_auth.php b/examples/consumer/try_auth.php index 464dd1f..b53f3cb 100644 --- a/examples/consumer/try_auth.php +++ b/examples/consumer/try_auth.php @@ -40,9 +40,25 @@ $auth_request->addExtensionArg('sreg', 'optional', 'email'); // Redirect the user to the OpenID server for authentication. Store // the token for this authentication so we can verify the response. -$redirect_url = $auth_request->redirectURL($trust_root, - $process_url); +if ($auth_request->shouldSendRedirect()) { + $redirect_url = $auth_request->redirectURL($trust_root, + $process_url); + header("Location: ".$redirect_url); +} else { + $form_id = 'openid_message'; + $form_html = $auth_request->formMarkup($trust_root, $process_url, false, + $form_tag_attrs=array('id' => $form_id)); -header("Location: ".$redirect_url); + if (is_a($form_html, 'Auth_OpenID_FailureResponse')) { + print "Error: " . $form_html->message; + } + +?> +<html><head><title>OpenID transaction in progress</title></head> +<body onload='document.getElementById("<?=$form_id?>").submit()'> +<?=$form_html?> +</body></html> +<? +} ?>
\ No newline at end of file |