summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/js/detect-migration.js
blob: e726515abc226f1ac2de60594c74a854a2bab789 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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: 'POST',
			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[id="message"]').html('<img src="' + OC.imagePath('core', 'loading-dark-small.gif') + '"/>  ' + message);
					$('p[id="message"]').removeClass('hidden').addClass('info');
				}
			}
		});
	});

});