From d9bf22a0e29c2a70049443a0ae8521a2c0492c8b Mon Sep 17 00:00:00 2001
From: Cash Costello
Date: Sun, 11 Dec 2011 06:38:23 -0500
Subject: initial commit for git repository
---
.../examples/server/lib/render/login.php | 65 ++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 models/openid-php-openid-782224d/examples/server/lib/render/login.php
(limited to 'models/openid-php-openid-782224d/examples/server/lib/render/login.php')
diff --git a/models/openid-php-openid-782224d/examples/server/lib/render/login.php b/models/openid-php-openid-782224d/examples/server/lib/render/login.php
new file mode 100644
index 000000000..986a88545
--- /dev/null
+++ b/models/openid-php-openid-782224d/examples/server/lib/render/login.php
@@ -0,0 +1,65 @@
+
+
+
+ Enter your username into this form to log in to this server. It
+ can be anything; this is just for demonstration purposes. For
+ example, entering USERNAME will give you the identity URL
+
+
%s
+
+
+
+
+');
+
+define('login_needed_pat',
+ 'You must be logged in as %s to approve this request.');
+
+function login_render($errors=null, $input=null, $needed=null)
+{
+ $current_user = getLoggedInUser();
+ if ($input === null) {
+ $input = $current_user;
+ }
+ if ($needed) {
+ $errors[] = sprintf(login_needed_pat, link_render($needed));
+ }
+
+ $esc_input = htmlspecialchars($input, ENT_QUOTES);
+ $login_url = buildURL('login', true);
+ $body = sprintf(login_form_pat, idURL('USERNAME'), $login_url, $esc_input);
+ if ($errors) {
+ $body = loginError_render($errors) . $body;
+ }
+ return page_render($body, $current_user, 'Log In', null, true);
+}
+
+function loginError_render($errors)
+{
+ $text = '';
+ foreach ($errors as $error) {
+ $text .= sprintf("%s\n", $error);
+ }
+ return sprintf("\n", $text);
+}
+?>
\ No newline at end of file
--
cgit v1.2.3