From 31f1f1f3e9daf815eff5878ac29d3c47d99d949f Mon Sep 17 00:00:00 2001 From: Dmitry Khomutov Date: Sun, 5 Feb 2017 16:54:59 +0700 Subject: [PATCH] Fixed default internal auth_provider --- src/PHPCensor/Command/CreateAdminCommand.php | 2 +- src/PHPCensor/Command/InstallCommand.php | 4 ++-- src/PHPCensor/Controller/UserController.php | 2 +- tests/PHPCensor/Service/UserServiceTest.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/PHPCensor/Command/CreateAdminCommand.php b/src/PHPCensor/Command/CreateAdminCommand.php index e64389b1..5ec5f932 100644 --- a/src/PHPCensor/Command/CreateAdminCommand.php +++ b/src/PHPCensor/Command/CreateAdminCommand.php @@ -71,7 +71,7 @@ class CreateAdminCommand extends Command $adminPass = $helper->ask($input, $output, $question); try { - $userService->createUser($adminName, $adminEmail, 'default', json_encode(['type' => 'internal']), $adminPass, true); + $userService->createUser($adminName, $adminEmail, 'internal', json_encode(['type' => 'internal']), $adminPass, true); $output->writeln('User account created!'); } catch (\Exception $e) { $output->writeln(sprintf('%s', 'PHP Censor failed to create your admin account.')); diff --git a/src/PHPCensor/Command/InstallCommand.php b/src/PHPCensor/Command/InstallCommand.php index 97762a1f..6545f23e 100644 --- a/src/PHPCensor/Command/InstallCommand.php +++ b/src/PHPCensor/Command/InstallCommand.php @@ -274,7 +274,7 @@ class InstallCommand extends Command 'disable_auth' => false, 'default_user_id' => 1, 'auth_providers' => [ - 'default' => [ + 'internal' => [ 'type' => 'internal', ], ], @@ -476,7 +476,7 @@ class InstallCommand extends Command /** @var UserStore $userStore */ $userStore = Factory::getStore('User'); $userService = new UserService($userStore); - $userService->createUser($admin['name'], $admin['email'], 'default', json_encode(['type' => 'internal']), $admin['password'], true); + $userService->createUser($admin['name'], $admin['email'], 'internal', json_encode(['type' => 'internal']), $admin['password'], true); $output->writeln('User account created!'); } catch (\Exception $ex) { diff --git a/src/PHPCensor/Controller/UserController.php b/src/PHPCensor/Controller/UserController.php index afbd324e..16a87cfa 100644 --- a/src/PHPCensor/Controller/UserController.php +++ b/src/PHPCensor/Controller/UserController.php @@ -180,7 +180,7 @@ class UserController extends Controller $password = $this->getParam('password', null); $isAdmin = (int)$this->getParam('is_admin', 0); - $this->userService->createUser($name, $email, 'default', json_encode(['type' => 'internal']), $password, $isAdmin); + $this->userService->createUser($name, $email, 'internal', json_encode(['type' => 'internal']), $password, $isAdmin); $response = new b8\Http\Response\RedirectResponse(); $response->setHeader('Location', APP_URL . 'user'); diff --git a/tests/PHPCensor/Service/UserServiceTest.php b/tests/PHPCensor/Service/UserServiceTest.php index fdfe0241..a107d38e 100644 --- a/tests/PHPCensor/Service/UserServiceTest.php +++ b/tests/PHPCensor/Service/UserServiceTest.php @@ -45,7 +45,7 @@ class UserServiceTest extends \PHPUnit_Framework_TestCase $user = $this->testedService->createUser( 'Test', 'test@example.com', - 'default', + 'internal', json_encode(['type' => 'internal']), 'testing', false @@ -62,7 +62,7 @@ class UserServiceTest extends \PHPUnit_Framework_TestCase $user = $this->testedService->createUser( 'Test', 'test@example.com', - 'default', + 'internal', json_encode(['type' => 'internal']), 'testing', true