add logout hook to remove keys from session
This commit is contained in:
parent
d2365afad6
commit
0b3ddbed68
4 changed files with 19 additions and 4 deletions
|
@ -122,6 +122,14 @@ class Hooks {
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -173,7 +181,6 @@ class Hooks {
|
|||
* @param array $params keys: uid, password
|
||||
*/
|
||||
public static function setPassphrase($params) {
|
||||
|
||||
if (\OCP\App::isEnabled('files_encryption') === false) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue