From 2fba3020034cae12c244713311a7c76d5a6a4800 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 9 May 2011 08:13:17 +0200 Subject: automatically register SSL client cert when user registers --- www/register.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'www') diff --git a/www/register.php b/www/register.php index dce65ba..d78ede3 100644 --- a/www/register.php +++ b/www/register.php @@ -72,15 +72,25 @@ if (POST_SUBMITTED != '') { $tplVars['error'] = T_('Antispam answer is not valid. Please try again.'); // Register details - } elseif ($userservice->addUser($posteduser, POST_PASS, POST_MAIL) !== false) { - // Log in with new username - $login = $userservice->login($posteduser, POST_PASS); - if ($login) { - header('Location: '. createURL('bookmarks', $posteduser)); - } - $tplVars['msg'] = T_('You have successfully registered. Enjoy!'); } else { - $tplVars['error'] = T_('Registration failed. Please try again.'); + $uId = $userservice->addUser($posteduser, POST_PASS, POST_MAIL); + if ($uId !== false) { + if (isset($_SERVER['SSL_CLIENT_VERIFY']) + && $_SERVER['SSL_CLIENT_VERIFY'] == 'SUCCESS' + ) { + $ssl = SemanticScuttle_Service_Factory::get('User_SslClientCert'); + $ssl->registerCurrentCertificate($uId); + $ssl->updateProfileFromCurentCert($uId); + } + // Log in with new username + $login = $userservice->login($posteduser, POST_PASS); + if ($login) { + header('Location: '. createURL('bookmarks', $posteduser)); + } + $tplVars['msg'] = T_('You have successfully registered. Enjoy!'); + } else { + $tplVars['error'] = T_('Registration failed. Please try again.'); + } } } -- cgit v1.2.3