improved admin settings
This commit is contained in:
parent
ebf3953908
commit
4a450c9d0d
|
@ -0,0 +1,23 @@
|
||||||
|
/**
|
||||||
|
* @author Björn Schießle <schiessle@owncloud.com>
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
||||||
|
* @license AGPL-3.0
|
||||||
|
*
|
||||||
|
* This code is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3,
|
||||||
|
* as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#encryptionAPI input[type=password] {
|
||||||
|
width: 300px;
|
||||||
|
}
|
|
@ -9,36 +9,50 @@
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
$('input:radio[name="adminEnableRecovery"]').change(
|
$('input:button[name="enableRecoveryKey"]').click(function () {
|
||||||
function () {
|
|
||||||
var recoveryStatus = $(this).val();
|
|
||||||
var oldStatus = (1 + parseInt(recoveryStatus)) % 2;
|
|
||||||
var recoveryPassword = $('#encryptionRecoveryPassword').val();
|
|
||||||
var confirmPassword = $('#repeatEncryptionRecoveryPassword').val();
|
|
||||||
OC.msg.startSaving('#encryptionSetRecoveryKey .msg');
|
|
||||||
$.post(
|
|
||||||
OC.generateUrl('/apps/encryption/ajax/adminRecovery'),
|
|
||||||
{
|
|
||||||
adminEnableRecovery: recoveryStatus,
|
|
||||||
recoveryPassword: recoveryPassword,
|
|
||||||
confirmPassword: confirmPassword
|
|
||||||
}
|
|
||||||
).done(function (data) {
|
|
||||||
OC.msg.finishedSuccess('#encryptionSetRecoveryKey .msg', data.data.message);
|
|
||||||
|
|
||||||
if (recoveryStatus === "0") {
|
var recoveryStatus = $(this).attr('status');
|
||||||
$('p[name="changeRecoveryPasswordBlock"]').addClass("hidden");
|
var newRecoveryStatus = (1 + parseInt(recoveryStatus)) % 2;
|
||||||
} else {
|
var buttonValue = $(this).attr('value');
|
||||||
$('input:password[name="changeRecoveryPassword"]').val("");
|
|
||||||
$('p[name="changeRecoveryPasswordBlock"]').removeClass("hidden");
|
var recoveryPassword = $('#encryptionRecoveryPassword').val();
|
||||||
}
|
var confirmPassword = $('#repeatEncryptionRecoveryPassword').val();
|
||||||
})
|
OC.msg.startSaving('#encryptionSetRecoveryKey .msg');
|
||||||
.fail(function (jqXHR) {
|
$.post(
|
||||||
$('input:radio[name="adminEnableRecovery"][value="' + oldStatus.toString() + '"]').attr("checked", "true");
|
OC.generateUrl('/apps/encryption/ajax/adminRecovery'),
|
||||||
OC.msg.finishedError('#encryptionSetRecoveryKey .msg', JSON.parse(jqXHR.responseText).data.message);
|
{
|
||||||
});
|
adminEnableRecovery: newRecoveryStatus,
|
||||||
|
recoveryPassword: recoveryPassword,
|
||||||
|
confirmPassword: confirmPassword
|
||||||
|
}
|
||||||
|
).done(function (data) {
|
||||||
|
OC.msg.finishedSuccess('#encryptionSetRecoveryKey .msg', data.data.message);
|
||||||
|
|
||||||
|
if (newRecoveryStatus === 0) {
|
||||||
|
$('p[name="changeRecoveryPasswordBlock"]').addClass("hidden");
|
||||||
|
$('input:button[name="enableRecoveryKey"]').attr('value', 'Enable recovery key');
|
||||||
|
$('input:button[name="enableRecoveryKey"]').attr('status', '0');
|
||||||
|
} else {
|
||||||
|
$('input:password[name="changeRecoveryPassword"]').val("");
|
||||||
|
$('p[name="changeRecoveryPasswordBlock"]').removeClass("hidden");
|
||||||
|
$('input:button[name="enableRecoveryKey"]').attr('value', 'Disable recovery key');
|
||||||
|
$('input:button[name="enableRecoveryKey"]').attr('status', '1');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.fail(function (jqXHR) {
|
||||||
|
$('input:button[name="enableRecoveryKey"]').attr('value', buttonValue);
|
||||||
|
$('input:button[name="enableRecoveryKey"]').attr('status', recoveryStatus);
|
||||||
|
OC.msg.finishedError('#encryptionSetRecoveryKey .msg', JSON.parse(jqXHR.responseText).data.message);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#repeatEncryptionRecoveryPassword").keyup(function (event) {
|
||||||
|
if (event.keyCode == 13) {
|
||||||
|
$("#enableRecoveryKey").click();
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
// change recovery password
|
// change recovery password
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
/** @var OC_L10N $l */
|
/** @var OC_L10N $l */
|
||||||
script('encryption', 'settings-admin');
|
script('encryption', 'settings-admin');
|
||||||
script('core', 'multiselect');
|
script('core', 'multiselect');
|
||||||
|
style('encryption', 'settings-admin');
|
||||||
?>
|
?>
|
||||||
<form id="ocDefaultEncryptionModule" class="sub-section">
|
<form id="ocDefaultEncryptionModule" class="sub-section">
|
||||||
<?php if(!$_["initStatus"]): ?>
|
<?php if(!$_["initStatus"]): ?>
|
||||||
<?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?>
|
<?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p id="encryptionSetRecoveryKey">
|
<p id="encryptionSetRecoveryKey">
|
||||||
<?php p($l->t('Enable recovery key: ')); ?>
|
<?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?>
|
||||||
<span class="msg"></span>
|
<span class="msg"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<em>
|
<em>
|
||||||
|
@ -17,54 +18,43 @@ script('core', 'multiselect');
|
||||||
to encrypt files. It allows recovery of a user's files if the user forgets their password.")) ?>
|
to encrypt files. It allows recovery of a user's files if the user forgets their password.")) ?>
|
||||||
</em>
|
</em>
|
||||||
<br/>
|
<br/>
|
||||||
<input type="password" name="encryptionRecoveryPassword" id="encryptionRecoveryPassword"/>
|
<input type="password"
|
||||||
<label for="recoveryPassword"><?php p($l->t("Recovery key password")); ?></label>
|
name="encryptionRecoveryPassword"
|
||||||
<br/>
|
id="encryptionRecoveryPassword"
|
||||||
<input type="password" name="encryptionRecoveryPassword" id="repeatEncryptionRecoveryPassword"/>
|
placeholder="<?php p($l->t("Recovery key password")); ?>"/>
|
||||||
<label for="repeatEncryptionRecoveryPassword"><?php p($l->t("Repeat Recovery key password")); ?></label>
|
<input type="password"
|
||||||
<br/>
|
name="encryptionRecoveryPassword"
|
||||||
<input
|
id="repeatEncryptionRecoveryPassword"
|
||||||
type='radio'
|
placeholder="<?php p($l->t("Repeat recovery key password")); ?>"/>
|
||||||
id='adminEnableRecovery'
|
<input type="button"
|
||||||
name='adminEnableRecovery'
|
name="enableRecoveryKey"
|
||||||
value='1'
|
id="enableRecoveryKey"
|
||||||
<?php echo($_["recoveryEnabled"] === '1' ? 'checked="checked"' : ''); ?> />
|
status="<?php p($_["recoveryEnabled"]) ?>"
|
||||||
<label for="adminEnableRecovery"><?php p($l->t("Enable recovery key")); ?></label>
|
value="<?php $_["recoveryEnabled"] === '0' ? p($l->t("Enable recovery key")) : p($l->t("Disable recovery key")); ?>"/>
|
||||||
<br/>
|
|
||||||
|
|
||||||
<input
|
|
||||||
type='radio'
|
|
||||||
id='adminDisableRecovery'
|
|
||||||
name='adminEnableRecovery'
|
|
||||||
value='0'
|
|
||||||
<?php echo($_["recoveryEnabled"] === '0' ? 'checked="checked"' : ''); ?> />
|
|
||||||
<label for="adminDisableRecovery"><?php p($l->t("Disable recovery key")); ?></label>
|
|
||||||
</p>
|
</p>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
<p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if ($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>>
|
<p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>>
|
||||||
<strong><?php p($l->t("Change recovery key password:")); ?></strong>
|
<?php p($l->t("Change recovery key password:")); ?>
|
||||||
<span class="msg"></span>
|
<span class="msg"></span>
|
||||||
<br/><br/>
|
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
name="changeRecoveryPassword"
|
|
||||||
id="oldEncryptionRecoveryPassword" />
|
|
||||||
<label for="oldEncryptionRecoveryPassword"><?php p($l->t("Old Recovery key password")); ?></label>
|
|
||||||
<br/>
|
|
||||||
<br/>
|
<br/>
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
name="changeRecoveryPassword"
|
name="changeRecoveryPassword"
|
||||||
id="newEncryptionRecoveryPassword" />
|
id="oldEncryptionRecoveryPassword"
|
||||||
<label for="newEncryptionRecoveryPassword"><?php p($l->t("New Recovery key password")); ?></label>
|
placeholder="<?php p($l->t("Old recovery key password")); ?>"/>
|
||||||
<br/>
|
<br />
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
name="changeRecoveryPassword"
|
name="changeRecoveryPassword"
|
||||||
id="repeatedNewEncryptionRecoveryPassword" />
|
id="newEncryptionRecoveryPassword"
|
||||||
<label for="repeatEncryptionRecoveryPassword"><?php p($l->t("Repeat New Recovery key password")); ?></label>
|
placeholder="<?php p($l->t("New recovery key password")); ?>"/>
|
||||||
<br/>
|
<input
|
||||||
|
type="password"
|
||||||
|
name="changeRecoveryPassword"
|
||||||
|
id="repeatedNewEncryptionRecoveryPassword"
|
||||||
|
placeholder="<?php p($l->t("Repeat new recovery key password")); ?>"/>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
name="submitChangeRecoveryKey">
|
name="submitChangeRecoveryKey">
|
||||||
|
|
Loading…
Reference in New Issue