Guillermo - paths enable/disable registration[skip ci]
This commit is contained in:
parent
91e539a053
commit
a317f6a29c
|
@ -9,6 +9,8 @@ require_once 'system/get-logs.php';
|
|||
require_once 'system/get-mail-templates.php';
|
||||
require_once 'system/edit-mail-template.php';
|
||||
require_once 'system/recover-mail-template.php';
|
||||
require_once 'system/disable-registration.php';
|
||||
require_once 'system/enable-registration.php';
|
||||
|
||||
$systemControllerGroup = new ControllerGroup();
|
||||
$systemControllerGroup->setGroupPath('/system');
|
||||
|
@ -23,5 +25,7 @@ $systemControllerGroup->addController(new GetLogsController);
|
|||
$systemControllerGroup->addController(new GetMailTemplatesController);
|
||||
$systemControllerGroup->addController(new EditMailTemplateController);
|
||||
$systemControllerGroup->addController(new RecoverMailTemplateController);
|
||||
$systemControllerGroup->addController(new DisableRegistrationController);
|
||||
$systemControllerGroup->addController(new EnableRegistrationController);
|
||||
|
||||
$systemControllerGroup->finalize();
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
class DisableRegistrationController extends Controller {
|
||||
const PATH = '/disable-registration';
|
||||
|
||||
public function validations() {
|
||||
return [
|
||||
'permission' => 'staff_3',
|
||||
'requestData' => []
|
||||
];
|
||||
}
|
||||
public function handler() {
|
||||
$password = Controller::request('password');
|
||||
|
||||
if(!Hashing::verifyPassword($password, Controller::getLoggedUser()->password)) {
|
||||
Response::respondError(ERRORS::INVALID_PASSWORD);
|
||||
return;
|
||||
}
|
||||
|
||||
$registrationRow = Setting::getSetting('registration');
|
||||
|
||||
$registrationRow->value = false;
|
||||
$registrationRow->store();
|
||||
|
||||
Response::respondSuccess();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
use Respect\Validation\Validator as DataValidator;
|
||||
|
||||
class EnableRegistrationController extends Controller {
|
||||
const PATH = '/enable-registration';
|
||||
public function validations() {
|
||||
return [
|
||||
'permission' => 'staff_3',
|
||||
'requestData' => []
|
||||
];
|
||||
}
|
||||
public function handler() {
|
||||
$password = Controller::request('password');
|
||||
|
||||
if(!Hashing::verifyPassword($password,Controller::getLoggedUser()->password)) {
|
||||
Response::respondError(ERRORS::INVALID_PASSWORD);
|
||||
return;
|
||||
}
|
||||
|
||||
$registrationRow = Setting::getSetting('registration');
|
||||
|
||||
$registrationRow->value = true;
|
||||
$registrationRow->store();
|
||||
|
||||
Response::respondSuccess();
|
||||
|
||||
}
|
||||
}
|
|
@ -40,7 +40,8 @@ class InitSettingsController extends Controller {
|
|||
'allow-attachments' => 0,
|
||||
'max-size' => 0,
|
||||
'title' => 'Support Center',
|
||||
'url' => 'http://www.opensupports.com/support'
|
||||
'url' => 'http://www.opensupports.com/support',
|
||||
'registration' => true
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue