]> source.dussan.org Git - nextcloud-server.git/commitdiff
add logout hook to remove keys from session
authorBjoern Schiessle <schiessle@owncloud.com>
Thu, 7 Aug 2014 13:26:09 +0000 (15:26 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Fri, 8 Aug 2014 07:36:48 +0000 (09:36 +0200)
apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/helper.php
apps/files_encryption/lib/session.php
apps/files_encryption/templates/settings-personal.php

index 4a257f2ad337947b19503b09d30068112ce55f8b..abfcb6d48cda1f6f659e4cbe47e9204d6c5c45a4 100644 (file)
@@ -136,6 +136,14 @@ class Hooks {
                return $result;\r
        }\r
 \r
+       /**\r
+        * remove keys from session during logout\r
+        */\r
+       public static function logout() {\r
+               $session = new \OCA\Encryption\Session(new \OC\Files\View());\r
+               $session->removeKeys();\r
+       }\r
+\r
        /**\r
         * setup encryption backend upon user created\r
         * @note This method should never be called for users using client side encryption\r
@@ -187,7 +195,6 @@ class Hooks {
         * @param array $params keys: uid, password\r
         */\r
        public static function setPassphrase($params) {\r
-\r
                if (\OCP\App::isEnabled('files_encryption') === false) {\r
                        return true;\r
                }\r
index ed42cec326af743a2b92f723a217cb43ff79d5fb..214e212b675403a9959beddef3942782569b2129 100755 (executable)
@@ -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');
index ef18b924dd8175c8279da7074a41f3ab3186a12d..e6d9fa554cf05ff08e0a272756b8b68ef274ce9b 100644 (file)
@@ -121,6 +121,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
index 3d44b9fa9a59967b0fa931b317c2808a7a1eeed8..832eb75e23dcc3239f70e7955a65284fc04755f9 100644 (file)
@@ -9,14 +9,13 @@
                <p>\r
                        <a name="changePKPasswd" />\r
                        <label for="changePrivateKeyPasswd">\r
-                               <?php p( $l->t( "Your private key password no longer match your log-in password:" ) ); ?>\r
+                               <em><?php p( $l->t( "Your private key password no longer match your log-in password." ) ); ?></em>\r
                        </label>\r
                        <br />\r
-                       <em><?php p( $l->t( "Set your old private key password to your current log-in password." ) ); ?>\r
+                       <?php p( $l->t( "Set your old private key password to your current log-in password:" ) ); ?>\r
                        <?php if (  $_["recoveryEnabledForUser"] ):\r
                                        p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) );\r
                        endif; ?>\r
-                       </em>\r
                        <br />\r
                        <input\r
                                type="password"\r