show a message at the log-in screen if inital encryption take place
parent
5310a5924b
commit
d6fb2afa85
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, Bjoern Schiessle <schiessle@owncloud.com>
|
||||
* This file is licensed under the Affero General Public License version 3 or later.
|
||||
* See the COPYING-README file.
|
||||
*
|
||||
* @brief check migration status
|
||||
*/
|
||||
use OCA\Encryption\Util;
|
||||
|
||||
\OCP\JSON::checkAppEnabled('files_encryption');
|
||||
|
||||
$user = isset($_GET['user']) ? $_GET['user'] : '';
|
||||
$password = isset($_GET['password']) ? $_GET['password'] : '';
|
||||
|
||||
$migrationCompleted = true;
|
||||
|
||||
if ($user !== '' && $password !== '') {
|
||||
if (\OCP\User::checkPassword($user, $password)) {
|
||||
error_log("password ok");
|
||||
$util = new Util(new \OC_FilesystemView('/'), $user);
|
||||
if ($util->getMigrationStatus($user) !== Util::MIGRATION_COMPLETED) {
|
||||
$migrationCompleted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\OCP\JSON::success(array('data' => array('migrationCompleted' => $migrationCompleted)));
|
||||
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) 2013
|
||||
* Bjoern Schiessle <schiessle@owncloud.com>
|
||||
* This file is licensed under the Affero General Public License version 3 or later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
$('form[name="login"]').on('submit', function(ev) {
|
||||
var user = $('#user').val();
|
||||
var password = $('#password').val();
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: OC.linkTo('files_encryption', 'ajax/getMigrationStatus.php'),
|
||||
dataType: 'json',
|
||||
data: {user: user, password: password},
|
||||
async: false,
|
||||
success: function(response) {
|
||||
if (response.data.migrationCompleted === false) {
|
||||
var message = t('files_encryption', 'Initial encryption started... This can take some time. Please wait.');
|
||||
$('p[name="message"]').html('<img src="' + OC.imagePath('core', 'loading-small.gif') + '"/> ' + message);
|
||||
$('p[name="message"]').removeClass('hidden').addClass('info');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Reference in New Issue