summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/ajax/getMigrationStatus.php
blob: ef3eb9fb10de4a4db185fad98d15cd71f878f483 (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
<?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.
 *
 * check migration status
 */

use OCA\Files_Encryption\Util;

\OCP\JSON::checkAppEnabled('files_encryption');

$loginname = isset($_POST['user']) ? (string)$_POST['user'] : '';
$password = isset($_POST['password']) ? (string)$_POST['password'] : '';

$migrationStatus = Util::MIGRATION_COMPLETED;

if ($loginname !== '' && $password !== '') {
	$username = \OCP\User::checkPassword($loginname, $password);
	if ($username) {
		$util = new Util(new \OC\Files\View('/'), $username);
		$migrationStatus = $util->getMigrationStatus();
	}
}

\OCP\JSON::success(array('data' => array('migrationStatus' => $migrationStatus)));