diff options
author | Christian Weiske <cweiske@cweiske.de> | 2011-05-11 06:57:07 +0200 |
---|---|---|
committer | Christian Weiske <cweiske@cweiske.de> | 2011-05-11 06:57:07 +0200 |
commit | b0665b03d105eb1e001cb1dd795bd94961471499 (patch) | |
tree | d04ca35b10932374dba0396a1f7c51ea9aff3a56 | |
parent | 73792c5807238045b426177a848f5a2cb429bb7c (diff) | |
download | semanticscuttle-b0665b03d105eb1e001cb1dd795bd94961471499.tar.gz semanticscuttle-b0665b03d105eb1e001cb1dd795bd94961471499.tar.bz2 |
registering the current client certificate works now
-rw-r--r-- | www/profile.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/www/profile.php b/www/profile.php index 5ffc959..9a58d79 100644 --- a/www/profile.php +++ b/www/profile.php @@ -114,6 +114,20 @@ if (POST_SUBMITTED!='' && $currentUser->getId() == $userid) { if (!$userservice->isLoggedOn() || $currentUser->getId() != $userid) { $templatename = 'profile.tpl.php'; } else { + $scert = SemanticScuttle_Service_Factory::get('User_SslClientCert'); + + if (isset($_POST['action']) && $_POST['action'] == 'registerCurrentCert') { + if (!$scert->hasValidCert()) { + $tplvars['error'] = T_('You do not have a valid SSL client certificate'); + } else if (false !== $scert->getUserIdFromCert()) { + $tplvars['error'] = T_('This certificate is already registered'); + } else if (false === $scert->registerCurrentCertificate($currentUser->getId())) { + $tplvars['error'] = T_('SSL client certificate registration failed'); + } else { + $tplVars['msg'] = T_('SSL client certificate registered'); + } + } + //Token Init $_SESSION['token'] = md5(uniqid(rand(), true)); $_SESSION['token_stamp'] = time(); @@ -123,7 +137,6 @@ if (!$userservice->isLoggedOn() || $currentUser->getId() != $userid) { $tplVars['formaction'] = createURL('profile', $user); $tplVars['token'] = $_SESSION['token']; - $scert = SemanticScuttle_Service_Factory::get('User_SslClientCert'); $tplVars['sslClientCerts'] = $scert->getUserCerts($currentUser->getId()); $tplVars['currentCert'] = null; if ($scert->hasValidCert()) { |