Disable all new registred users

This commit is contained in:
Neraste 2017-10-21 12:53:53 +02:00
parent 280c47a45d
commit 8c6da61f46
5 changed files with 20 additions and 3 deletions

View File

@ -149,7 +149,17 @@ class RegisterController extends Controller {
], 'guest');
}
if ($user->isEnabled()) {
// log the user
return $this->registrationService->loginUser($user->getUID(), $username, $password, false);
} else {
// warn the user their account needs admin validation
return new TemplateResponse(
'registration',
'message',
array('msg' => "Your account has been successfully created, but it still needs approval from an administrator."),
'guest');
}
}
private function renderError($error, $hint="") {

View File

@ -135,9 +135,9 @@ class MailService {
'user' => $username,
'sitename' => $this->defaults->getName()
];
$html_template = new TemplateResponse('registration', 'email.newuser_html', $template_var, 'blank');
$html_template = new TemplateResponse('registration', 'email.newuser.disabled_html', $template_var, 'blank');
$html_part = $html_template->render();
$plaintext_template = new TemplateResponse('registration', 'email.newuser_plaintext', $template_var, 'blank');
$plaintext_template = new TemplateResponse('registration', 'email.newuser.disabled_plaintext', $template_var, 'blank');
$plaintext_part = $plaintext_template->render();
$subject = $this->l10n->t('A new user "%s" has created an account on %s', [$username, $this->defaults->getName()]);

View File

@ -293,6 +293,9 @@ class RegistrationService {
}
}
// Disable user unconditionaly
$user->setEnabled(false);
// Delete pending registration if no client secret is stored
if($registration->getClientSecret() === null) {
$res = $this->registrationMapper->delete($registration);

View File

@ -0,0 +1,2 @@
<?php
echo $l->t('A new user "%s" has created an account on %s and awaits admin validation', [$_['user'], $_['sitename']]);

View File

@ -0,0 +1,2 @@
<?php
echo $l->t('A new user "%s" has created an account on %s and awaits admin validation', [$_['user'], $_['sitename']]);