From b212c837f0fab0c95c0699afc63e7085e094f88f Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 4 May 2011 17:13:14 +0200 Subject: [PATCH] autofill registration form email address if user has a ssl client certificate --- data/templates/register.tpl.php | 2 +- www/register.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/data/templates/register.tpl.php b/data/templates/register.tpl.php index da3deec..62cebad 100644 --- a/data/templates/register.tpl.php +++ b/data/templates/register.tpl.php @@ -24,7 +24,7 @@ window.onload = function() { - + diff --git a/www/register.php b/www/register.php index c01939a..dce65ba 100644 --- a/www/register.php +++ b/www/register.php @@ -34,7 +34,13 @@ if (!$GLOBALS['enableRegistration']) { isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', ''); isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', ''); isset($_POST['password']) ? define('POST_PASS', $_POST['password']): define('POST_PASS', ''); -isset($_POST['email']) ? define('POST_MAIL', $_POST['email']): define('POST_MAIL', ''); +if (isset($_POST['email'])) { + define('POST_MAIL', $_POST['email']); +} else if (isset($_SERVER['SSL_CLIENT_S_DN_Email'])) { + define('POST_MAIL', $_SERVER['SSL_CLIENT_S_DN_Email']); +} else { + define('POST_MAIL', ''); +} isset($_POST['antispamAnswer']) ? define('POST_ANTISPAMANSWER', $_POST['antispamAnswer']): define('POST_ANTISPAMANSWER', '');