From 0055edb0bd0e5c27bea48a365e99e47797dce683 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Thu, 13 Dec 2007 09:35:44 +0000
Subject: [PATCH] Show error pages from login-auto authentication handler.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@95 44740490-163a-0410-bde0-09ae8108e29a
---
 www/auth/login-auto.php | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/www/auth/login-auto.php b/www/auth/login-auto.php
index 9a40f388a..84b4a5d21 100644
--- a/www/auth/login-auto.php
+++ b/www/auth/login-auto.php
@@ -38,8 +38,13 @@ if(!$enable) {
 	     ' want to enable this authentication handler, set' .
 	     ' \'login_auto.enable\' to true.';
 	error_log($e);
-	/* TODO: show error page. */
-	exit(1);
+
+	$t = new SimpleSAML_XHTML_Template($config, 'error.php');
+	$t->data['header'] = 'login-auto: configuration error';
+	$t->data['message'] = $e;
+	$t->show();
+
+	exit;
 }
 
 /* Verify that the 'login_auto.attributes' option is configured. */
@@ -49,8 +54,13 @@ if(!is_array($attributes)) {
 	     ' \'login_auto.attributes\' to the attributes you want to give' .
 	     ' users.';
 	error_log($e);
-	/* TODO: show error page. */
-	exit(1);
+
+	$t = new SimpleSAML_XHTML_Template($config, 'error.php');
+	$t->data['header'] = 'login-auto: configuration error';
+	$t->data['message'] = $e;
+	$t->show();
+
+	exit;
 }
 
 
@@ -79,8 +89,13 @@ $session = SimpleSAML_Session::getInstance();
 if($session == NULL) {
 	$e = 'No session was found. Are cookies disabled?';
 	error_log($e);
-	/* TODO: show error page. */
-	exit(1);
+
+	$t = new SimpleSAML_XHTML_Template($config, 'error.php');
+	$t->data['header'] = 'login-auto: missing session';
+	$t->data['message'] = $e;
+	$t->show();
+
+	exit;
 }
 
 /* Set the user as authenticated and add the attributes from the
-- 
GitLab