]> source.dussan.org Git - nextcloud-server.git/commitdiff
add setting templates
authorBjoern Schiessle <schiessle@owncloud.com>
Fri, 27 Mar 2015 14:01:46 +0000 (15:01 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 7 Apr 2015 11:30:28 +0000 (13:30 +0200)
apps/encryption/appinfo/encryption.php
apps/encryption/settings/settings-admin.php
apps/encryption/templates/invalid_private_key.php [new file with mode: 0644]
apps/encryption/templates/settings-admin.php [new file with mode: 0644]
apps/encryption/templates/settings-personal.php [new file with mode: 0644]

index a389abe5daec35b66250e2dfea910096f89a1232..d97aa07738ce58e6602d49e33bed894d9950a11d 100644 (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();
index a32359bdfac6861c7b24daa0746d8474926f69bc..813956aa0af64d720665b26d38b9e9180cf2bb9a 100644 (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');
diff --git a/apps/encryption/templates/invalid_private_key.php b/apps/encryption/templates/invalid_private_key.php
new file mode 100644 (file)
index 0000000..b148e65
--- /dev/null
@@ -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>
diff --git a/apps/encryption/templates/settings-admin.php b/apps/encryption/templates/settings-admin.php
new file mode 100644 (file)
index 0000000..252701e
--- /dev/null
@@ -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>
diff --git a/apps/encryption/templates/settings-personal.php b/apps/encryption/templates/settings-personal.php
new file mode 100644 (file)
index 0000000..a28df9a
--- /dev/null
@@ -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>