mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-29 16:54:53 +02:00
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();
|
27
server/controllers/system/disable-registration.php
Normal file
27
server/controllers/system/disable-registration.php
Normal file
@ -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();
|
||||
}
|
||||
}
|
28
server/controllers/system/enable-registration.php
Normal file
28
server/controllers/system/enable-registration.php
Normal file
@ -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…
x
Reference in New Issue
Block a user