mirror of
https://github.com/friendica/friendica
synced 2025-04-24 03:10:11 +00:00
Ensure register records aren't created with uid = 0
- uid = 0 matches system account and public contact records, giving unexpected display in pending user list. More importantly, the originally created user can't be approved since its user id is lost.
This commit is contained in:
parent
c07af2a0ed
commit
6460218c0e
2 changed files with 28 additions and 11 deletions
|
@ -353,6 +353,7 @@ class Register extends BaseModule
|
|||
}
|
||||
} elseif (intval(DI::config()->get('config', 'register_policy')) === self::APPROVE) {
|
||||
if (!User::getAdminEmailList()) {
|
||||
$this->logger->critical('Registration policy is set to APPROVE but no admin email address has been set in config.admin_email');
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Your registration can not be processed.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
@ -362,10 +363,17 @@ class Register extends BaseModule
|
|||
DI::sysmsg()->addNotice(DI::l10n()->t('You have to leave a request note for the admin.')
|
||||
. DI::l10n()->t('Your registration can not be processed.'));
|
||||
|
||||
DI::baseUrl()->redirect('register/');
|
||||
$this->baseUrl->redirect('register');
|
||||
}
|
||||
|
||||
Model\Register::createForApproval($user['uid'], DI::config()->get('system', 'language'), $_POST['permonlybox']);
|
||||
try {
|
||||
Model\Register::createForApproval($user['uid'], DI::config()->get('system', 'language'), $_POST['permonlybox']);
|
||||
} catch (\Throwable $e) {
|
||||
$this->logger->error('Unable to create a `register` record.', ['user' => $user]);
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('An internal error occured.')
|
||||
. DI::l10n()->t('Your registration can not be processed.'));
|
||||
$this->baseUrl->redirect('register');
|
||||
}
|
||||
|
||||
// invite system
|
||||
if ($using_invites && $invite_id) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue