add setting templates

This commit is contained in:
Bjoern Schiessle 2015-03-27 15:01:46 +01:00 committed by Thomas Müller
parent 37e8268447
commit bd99042a66
5 changed files with 155 additions and 2 deletions

View File

@ -85,7 +85,7 @@ class Encryption extends \OCP\AppFramework\App {
$container->query('UserSetup'),
$server->getUserSession(),
new \OCP\Util(),
$container->query('Util'),),
$container->query('Util')),
]);
$hookManager->fireHooks();

View File

@ -10,7 +10,7 @@ use OCA\Encryption\KeyManager;
\OC_Util::checkAdminUser();
$tmpl = new OCP\Template('files_encryption', 'settings-admin');
$tmpl = new OCP\Template('encryption', 'settings-admin');
// Check if an adminRecovery account is enabled for recovering files after lost pwd
$recoveryAdminEnabled = \OC::$server->getConfig()->getAppValue('encryption', 'recoveryAdminEnabled', '0');

View File

@ -0,0 +1,12 @@
<ul>
<li class='error'>
<?php $location = \OC_Helper::linkToRoute( "settings_personal" ).'#changePKPasswd' ?>
<?php p($_['message']); ?>
<br/>
<?php if($_['errorCode'] === \OCA\Files_Encryption\Crypt::ENCRYPTION_PRIVATE_KEY_NOT_VALID_ERROR): ?>
<?php p($l->t('Go directly to your %spersonal settings%s.', array('<a href="'.$location.'">', '</a>'))); ?>
<?php endif; ?>
<br/>
</li>
</ul>

View File

@ -0,0 +1,71 @@
<?php
/** @var array $_ */
/** @var OC_L10N $l */
?>
<form id="encryption" class="section">
<h2><?php p($l->t('ownCloud basic encryption module')); ?></h2>
<?php if($_["initStatus"] === \OCA\Files_Encryption\Session::NOT_INITIALIZED): ?>
<?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?>
<?php else: ?>
<p id="encryptionSetRecoveryKey">
<?php p($l->t("Enable recovery key (allow to recover users files in case of password loss):")); ?>
<span class="msg"></span>
<br/>
<br/>
<input type="password" name="encryptionRecoveryPassword" id="encryptionRecoveryPassword"/>
<label for="recoveryPassword"><?php p($l->t("Recovery key password")); ?></label>
<br/>
<input type="password" name="encryptionRecoveryPassword" id="repeatEncryptionRecoveryPassword"/>
<label for="repeatEncryptionRecoveryPassword"><?php p($l->t("Repeat Recovery key password")); ?></label>
<br/>
<input
type='radio'
id='adminEnableRecovery'
name='adminEnableRecovery'
value='1'
<?php echo($_["recoveryEnabled"] === '1' ? 'checked="checked"' : ''); ?> />
<label for="adminEnableRecovery"><?php p($l->t("Enabled")); ?></label>
<br/>
<input
type='radio'
id='adminDisableRecovery'
name='adminEnableRecovery'
value='0'
<?php echo($_["recoveryEnabled"] === '0' ? 'checked="checked"' : ''); ?> />
<label for="adminDisableRecovery"><?php p($l->t("Disabled")); ?></label>
</p>
<br/><br/>
<p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if ($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>>
<strong><?php p($l->t("Change recovery key password:")); ?></strong>
<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/>
<input
type="password"
name="changeRecoveryPassword"
id="newEncryptionRecoveryPassword" />
<label for="newEncryptionRecoveryPassword"><?php p($l->t("New Recovery key password")); ?></label>
<br/>
<input
type="password"
name="changeRecoveryPassword"
id="repeatedNewEncryptionRecoveryPassword" />
<label for="repeatEncryptionRecoveryPassword"><?php p($l->t("Repeat New Recovery key password")); ?></label>
<br/>
<button
type="button"
name="submitChangeRecoveryKey">
<?php p($l->t("Change Password")); ?>
</button>
</p>
<?php endif; ?>
</form>

View File

@ -0,0 +1,70 @@
<?php
/** @var array $_ */
/** @var OC_L10N $l */
?>
<form id="encryption" class="section">
<h2><?php p($l->t('ownCloud basic encryption module')); ?></h2>
<?php if ( $_["initialized"] === \OCA\Files_Encryption\Session::NOT_INITIALIZED ): ?>
<?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?>
<?php elseif ( $_["initialized"] === \OCA\Files_Encryption\Session::INIT_EXECUTED ): ?>
<p>
<a name="changePKPasswd" />
<label for="changePrivateKeyPasswd">
<em><?php p( $l->t( "Your private key password no longer matches your log-in password." ) ); ?></em>
</label>
<br />
<?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; ?>
<br />
<input
type="password"
name="changePrivateKeyPassword"
id="oldPrivateKeyPassword" />
<label for="oldPrivateKeyPassword"><?php p($l->t( "Old log-in password" )); ?></label>
<br />
<input
type="password"
name="changePrivateKeyPassword"
id="newPrivateKeyPassword" />
<label for="newRecoveryPassword"><?php p($l->t( "Current log-in password" )); ?></label>
<br />
<button
type="button"
name="submitChangePrivateKeyPassword"
disabled><?php p($l->t( "Update Private Key Password" )); ?>
</button>
<span class="msg"></span>
</p>
<?php elseif ( $_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Files_Encryption\Session::INIT_SUCCESSFUL ): ?>
<br />
<p id="userEnableRecovery">
<label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label>
<span class="msg"></span>
<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>
<br />
<input
type='radio'
id='userEnableRecovery'
name='userEnableRecovery'
value='1'
<?php echo ( $_["recoveryEnabledForUser"] ? 'checked="checked"' : '' ); ?> />
<label for="userEnableRecovery"><?php p( $l->t( "Enabled" ) ); ?></label>
<br />
<input
type='radio'
id='userDisableRecovery'
name='userEnableRecovery'
value='0'
<?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> />
<label for="userDisableRecovery"><?php p( $l->t( "Disabled" ) ); ?></label>
</p>
<?php endif; ?>
</form>