[Pkg-owncloud-commits] [owncloud] 36/121: add logout hook to remove keys from session
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 16:44:29 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 18c023da166b81c82f2d979a264c35d6aac7272f
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date: Thu Aug 7 15:26:09 2014 +0200
add logout hook to remove keys from session
---
apps/files_encryption/hooks/hooks.php | 9 ++++++++-
apps/files_encryption/lib/helper.php | 1 +
apps/files_encryption/lib/session.php | 8 ++++++++
apps/files_encryption/templates/settings-personal.php | 5 ++---
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 4a257f2..abfcb6d 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -137,6 +137,14 @@ class Hooks {
}
/**
+ * remove keys from session during logout
+ */
+ public static function logout() {
+ $session = new \OCA\Encryption\Session(new \OC\Files\View());
+ $session->removeKeys();
+ }
+
+ /**
* setup encryption backend upon user created
* @note This method should never be called for users using client side encryption
*/
@@ -187,7 +195,6 @@ class Hooks {
* @param array $params keys: uid, password
*/
public static function setPassphrase($params) {
-
if (\OCP\App::isEnabled('files_encryption') === false) {
return true;
}
diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php
index ed42cec..214e212 100755
--- a/apps/files_encryption/lib/helper.php
+++ b/apps/files_encryption/lib/helper.php
@@ -49,6 +49,7 @@ class Helper {
public static function registerUserHooks() {
\OCP\Util::connectHook('OC_User', 'post_login', 'OCA\Encryption\Hooks', 'login');
+ \OCP\Util::connectHook('OC_User', 'logout', 'OCA\Encryption\Hooks', 'logout');
\OCP\Util::connectHook('OC_User', 'post_setPassword', 'OCA\Encryption\Hooks', 'setPassphrase');
\OCP\Util::connectHook('OC_User', 'pre_setPassword', 'OCA\Encryption\Hooks', 'preSetPassphrase');
\OCP\Util::connectHook('OC_User', 'post_createUser', 'OCA\Encryption\Hooks', 'postCreateUser');
diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php
index ef18b92..e6d9fa5 100644
--- a/apps/files_encryption/lib/session.php
+++ b/apps/files_encryption/lib/session.php
@@ -122,6 +122,14 @@ class Session {
}
/**
+ * remove keys from session
+ */
+ public function removeKeys() {
+ \OC::$session->remove('publicSharePrivateKey');
+ \OC::$session->remove('privateKey');
+ }
+
+ /**
* Sets status of encryption app
* @param string $init INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED
* @return bool
diff --git a/apps/files_encryption/templates/settings-personal.php b/apps/files_encryption/templates/settings-personal.php
index 3d44b9f..832eb75 100644
--- a/apps/files_encryption/templates/settings-personal.php
+++ b/apps/files_encryption/templates/settings-personal.php
@@ -9,14 +9,13 @@
<p>
<a name="changePKPasswd" />
<label for="changePrivateKeyPasswd">
- <?php p( $l->t( "Your private key password no longer match your log-in password:" ) ); ?>
+ <em><?php p( $l->t( "Your private key password no longer match your log-in password." ) ); ?></em>
</label>
<br />
- <em><?php p( $l->t( "Set your old private key password to your current log-in password." ) ); ?>
+ <?php p( $l->t( "Set your old private key password to your current log-in password:" ) ); ?>
<?php if ( $_["recoveryEnabledForUser"] ):
p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) );
endif; ?>
- </em>
<br />
<input
type="password"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list