server/apps/files_encryption/ajax/getMigrationStatus.php

27 lines
791 B
PHP
Raw Normal View History

<?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\Encryption\Util;
\OCP\JSON::checkAppEnabled('files_encryption');
2013-11-28 12:26:31 +00:00
$loginname = isset($_POST['user']) ? $_POST['user'] : '';
2013-11-26 10:38:49 +00:00
$password = isset($_POST['password']) ? $_POST['password'] : '';
$migrationStatus = Util::MIGRATION_COMPLETED;
2013-11-28 12:26:31 +00:00
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)));