2017-01-10 19:22:36 +01:00
|
|
|
<?php
|
|
|
|
use Respect\Validation\Validator as DataValidator;
|
|
|
|
|
|
|
|
class EnableRegistrationController extends Controller {
|
|
|
|
const PATH = '/enable-registration';
|
2017-02-08 19:09:15 +01:00
|
|
|
const METHOD = 'POST';
|
2017-01-11 07:50:47 +01:00
|
|
|
|
2017-01-10 19:22:36 +01:00
|
|
|
public function validations() {
|
|
|
|
return [
|
|
|
|
'permission' => 'staff_3',
|
|
|
|
'requestData' => []
|
|
|
|
];
|
|
|
|
}
|
2017-01-11 07:50:47 +01:00
|
|
|
|
2017-01-10 19:22:36 +01:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|