summaryrefslogtreecommitdiffstats
path: root/core/lostpassword
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-06-05 18:38:39 +0200
committerBjörn Schießle <schiessle@owncloud.com>2013-06-05 18:38:39 +0200
commit58fd76607b3b874ecf9d852e9cc3dd95504a8fb8 (patch)
tree6ce0a2b0abacdd97b3c4ac4401329bac00aa0e15 /core/lostpassword
parent036732c249b82f7da478cf6e54a7844ce5522824 (diff)
downloadnextcloud-server-58fd76607b3b874ecf9d852e9cc3dd95504a8fb8.tar.gz
nextcloud-server-58fd76607b3b874ecf9d852e9cc3dd95504a8fb8.zip
print a warning if a user wants to reset his password and encryption is enabled
Diffstat (limited to 'core/lostpassword')
-rw-r--r--core/lostpassword/controller.php14
-rw-r--r--core/lostpassword/templates/lostpassword.php8
2 files changed, 20 insertions, 2 deletions
diff --git a/core/lostpassword/controller.php b/core/lostpassword/controller.php
index fbcf4a87f22..9377de5d39a 100644
--- a/core/lostpassword/controller.php
+++ b/core/lostpassword/controller.php
@@ -8,8 +8,11 @@
class OC_Core_LostPassword_Controller {
protected static function displayLostPasswordPage($error, $requested) {
+ $encrypted = OC_App::isEnabled('files_encryption');
OC_Template::printGuestPage('core/lostpassword', 'lostpassword',
- array('error' => $error, 'requested' => $requested));
+ array('error' => $error,
+ 'requested' => $requested,
+ 'encrypted' => $encrypted));
}
protected static function displayResetPasswordPage($success, $args) {
@@ -29,7 +32,14 @@ class OC_Core_LostPassword_Controller {
}
public static function sendEmail($args) {
- if (OC_User::userExists($_POST['user'])) {
+
+ if(isset($_POST['noEncryption']) || isset($_POST['continue'])) {
+ $continue = true;
+ } else {
+ $continue = false;
+ }
+
+ if (OC_User::userExists($_POST['user']) && $continue) {
$token = hash('sha256', OC_Util::generate_random_bytes(30).OC_Config::getValue('passwordsalt', ''));
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword',
hash('sha256', $token)); // Hash the token again to prevent timing attacks
diff --git a/core/lostpassword/templates/lostpassword.php b/core/lostpassword/templates/lostpassword.php
index c19c6893f13..c082ee977da 100644
--- a/core/lostpassword/templates/lostpassword.php
+++ b/core/lostpassword/templates/lostpassword.php
@@ -17,6 +17,14 @@
<input type="text" name="user" id="user" placeholder="" value="" autocomplete="off" required autofocus />
<label for="user" class="infield"><?php print_unescaped($l->t( 'Username' )); ?></label>
<img class="svg" src="<?php print_unescaped(image_path('', 'actions/user.svg')); ?>" alt=""/>
+ <?php if ($_['encrypted']): ?>
+ <br /><br />
+ <?php print_unescaped($l->t('Your files seems to be encrypted. If you didn\'t have enabled the recovery key there will be no way to get your data back once the password was resetted. If you are not sure what to do, please contact your administrator first before continue. Do you really want to continue?')); ?><br />
+ <input type="checkbox" name="continue" value="Yes" />
+ <?php print_unescaped($l->t('Yes, I really want to reset my password now')); ?><br/><br/>
+ <?php else: ?>
+ <input type="checkbox" name="noEncryption" value="Yes" checked />
+ <?php endif; ?>
</p>
<input type="submit" id="submit" value="<?php print_unescaped($l->t('Request reset')); ?>" />
</fieldset>