Disable all new registred users
This commit is contained in:
parent
280c47a45d
commit
8c6da61f46
|
|
@ -149,7 +149,17 @@ class RegisterController extends Controller {
|
||||||
], 'guest');
|
], 'guest');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->registrationService->loginUser($user->getUID(), $username, $password, false);
|
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="") {
|
private function renderError($error, $hint="") {
|
||||||
|
|
|
||||||
|
|
@ -135,9 +135,9 @@ class MailService {
|
||||||
'user' => $username,
|
'user' => $username,
|
||||||
'sitename' => $this->defaults->getName()
|
'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();
|
$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();
|
$plaintext_part = $plaintext_template->render();
|
||||||
$subject = $this->l10n->t('A new user "%s" has created an account on %s', [$username, $this->defaults->getName()]);
|
$subject = $this->l10n->t('A new user "%s" has created an account on %s', [$username, $this->defaults->getName()]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -293,6 +293,9 @@ class RegistrationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable user unconditionaly
|
||||||
|
$user->setEnabled(false);
|
||||||
|
|
||||||
// Delete pending registration if no client secret is stored
|
// Delete pending registration if no client secret is stored
|
||||||
if($registration->getClientSecret() === null) {
|
if($registration->getClientSecret() === null) {
|
||||||
$res = $this->registrationMapper->delete($registration);
|
$res = $this->registrationMapper->delete($registration);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?php
|
||||||
|
echo $l->t('A new user "%s" has created an account on %s and awaits admin validation', [$_['user'], $_['sitename']]);
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?php
|
||||||
|
echo $l->t('A new user "%s" has created an account on %s and awaits admin validation', [$_['user'], $_['sitename']]);
|
||||||
Loading…
Reference in New Issue