diff options
Diffstat (limited to 'www/register.php')
-rw-r--r-- | www/register.php | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/www/register.php b/www/register.php index c01939a..d78ede3 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', ''); @@ -66,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.'); + } } } |