summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-05-11 07:33:15 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-05-11 07:33:15 +0200
commit1c415919cb72c218d9491d8cdcf6498142b23f68 (patch)
treec1425c3e4793dee1dc93c9f8b2c83a5cbd8718fe /www
parentb0665b03d105eb1e001cb1dd795bd94961471499 (diff)
downloadsemanticscuttle-1c415919cb72c218d9491d8cdcf6498142b23f68.tar.gz
semanticscuttle-1c415919cb72c218d9491d8cdcf6498142b23f68.tar.bz2
deleting ssl client certificates from profile page works now
Diffstat (limited to 'www')
-rw-r--r--www/profile.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/www/profile.php b/www/profile.php
index 9a58d79..c2c256c 100644
--- a/www/profile.php
+++ b/www/profile.php
@@ -122,12 +122,27 @@ if (!$userservice->isLoggedOn() || $currentUser->getId() != $userid) {
} 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');
+ $tplvars['error'] = T_('Failed to register SSL client certificate.');
} else {
- $tplVars['msg'] = T_('SSL client certificate registered');
+ $tplVars['msg'] = T_('SSL client certificate registered.');
+ }
+ } else if (isset($_POST['action']) && $_POST['action'] == 'deleteClientCert'
+ && isset($_POST['certId'])
+ ) {
+ $certId = (int)$_POST['certId'];
+ $cert = $scert->getCert($certId);
+ if ($cert === null) {
+ $tplvars['error'] = T_('Certificate not found.');
+ } else if ($cert->uId != $currentUser->getId()) {
+ $tplvars['error'] = T_('The certificate does not belong to you.');
+ } else if (false === $scert->delete($certId)) {
+ $tplvars['error'] = T_('Failed to delete SSL client certificate.');
+ } else {
+ $tplVars['msg'] = T_('SSL client certificate deleted.');
}
}
+
//Token Init
$_SESSION['token'] = md5(uniqid(rand(), true));
$_SESSION['token_stamp'] = time();