improved visual feedback if user enabled recovery key
This commit is contained in:
parent
794d3ef949
commit
b060123155
|
@ -13,6 +13,8 @@ use OCA\Encryption;
|
||||||
\OCP\JSON::checkAppEnabled('files_encryption');
|
\OCP\JSON::checkAppEnabled('files_encryption');
|
||||||
\OCP\JSON::callCheck();
|
\OCP\JSON::callCheck();
|
||||||
|
|
||||||
|
$l = \OC::$server->getL10N('files_encryption');
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isset($_POST['userEnableRecovery'])
|
isset($_POST['userEnableRecovery'])
|
||||||
&& (0 == $_POST['userEnableRecovery'] || '1' === $_POST['userEnableRecovery'])
|
&& (0 == $_POST['userEnableRecovery'] || '1' === $_POST['userEnableRecovery'])
|
||||||
|
@ -38,4 +40,8 @@ if (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return success or failure
|
// Return success or failure
|
||||||
($return) ? \OCP\JSON::success() : \OCP\JSON::error();
|
if ($return) {
|
||||||
|
\OCP\JSON::success(array('data' => array('message' => $l->t('File recovery settings updated'))));
|
||||||
|
} else {
|
||||||
|
\OCP\JSON::error(array('data' => array('message' => $l->t('Could not update file recovery'))));
|
||||||
|
}
|
||||||
|
|
|
@ -26,36 +26,27 @@ $(document).ready(function(){
|
||||||
// Trigger ajax on recoveryAdmin status change
|
// Trigger ajax on recoveryAdmin status change
|
||||||
$( 'input:radio[name="userEnableRecovery"]' ).change(
|
$( 'input:radio[name="userEnableRecovery"]' ).change(
|
||||||
function() {
|
function() {
|
||||||
|
|
||||||
// Hide feedback messages in case they're already visible
|
|
||||||
$('#recoveryEnabledSuccess').hide();
|
|
||||||
$('#recoveryEnabledError').hide();
|
|
||||||
|
|
||||||
var recoveryStatus = $( this ).val();
|
var recoveryStatus = $( this ).val();
|
||||||
|
OC.msg.startAction('#userEnableRecovery .msg', 'Updating recovery keys. This can take some time...');
|
||||||
$.post(
|
$.post(
|
||||||
OC.filePath( 'files_encryption', 'ajax', 'userrecovery.php' )
|
OC.filePath( 'files_encryption', 'ajax', 'userrecovery.php' )
|
||||||
, { userEnableRecovery: recoveryStatus }
|
, { userEnableRecovery: recoveryStatus }
|
||||||
, function( data ) {
|
, function( data ) {
|
||||||
if ( data.status == "success" ) {
|
OC.msg.finishedAction('#userEnableRecovery .msg', data);
|
||||||
$('#recoveryEnabledSuccess').show();
|
|
||||||
} else {
|
|
||||||
$('#recoveryEnabledError').show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// Ensure page is not reloaded on form submit
|
// Ensure page is not reloaded on form submit
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#encryptAll").click(
|
$("#encryptAll").click(
|
||||||
function(){
|
function(){
|
||||||
|
|
||||||
// Hide feedback messages in case they're already visible
|
// Hide feedback messages in case they're already visible
|
||||||
$('#encryptAllSuccess').hide();
|
$('#encryptAllSuccess').hide();
|
||||||
$('#encryptAllError').hide();
|
$('#encryptAllError').hide();
|
||||||
|
|
||||||
var userPassword = $( '#userPassword' ).val();
|
var userPassword = $( '#userPassword' ).val();
|
||||||
var encryptAll = $( '#encryptAll' ).val();
|
var encryptAll = $( '#encryptAll' ).val();
|
||||||
|
|
||||||
|
@ -73,7 +64,7 @@ $(document).ready(function(){
|
||||||
// Ensure page is not reloaded on form submit
|
// Ensure page is not reloaded on form submit
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// update private key password
|
// update private key password
|
||||||
|
|
|
@ -39,8 +39,9 @@
|
||||||
|
|
||||||
<?php elseif ( $_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL ): ?>
|
<?php elseif ( $_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL ): ?>
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p id="userEnableRecovery">
|
||||||
<label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label>
|
<label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label>
|
||||||
|
<span class="msg"></span>
|
||||||
<br />
|
<br />
|
||||||
<em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em>
|
<em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em>
|
||||||
<br />
|
<br />
|
||||||
|
@ -60,8 +61,6 @@
|
||||||
value='0'
|
value='0'
|
||||||
<?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> />
|
<?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> />
|
||||||
<label for="userDisableRecovery"><?php p( $l->t( "Disabled" ) ); ?></label>
|
<label for="userDisableRecovery"><?php p( $l->t( "Disabled" ) ); ?></label>
|
||||||
<div id="recoveryEnabledSuccess"><?php p( $l->t( 'File recovery settings updated' ) ); ?></div>
|
|
||||||
<div id="recoveryEnabledError"><?php p( $l->t( 'Could not update file recovery' ) ); ?></div>
|
|
||||||
</p>
|
</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue