Improved notices
This commit is contained in:
parent
7ee7bd72fd
commit
5c0f0c9c19
|
@ -44,20 +44,20 @@ class Register extends BaseModule
|
|||
$block = Config::get('system', 'block_extended_register');
|
||||
|
||||
if (local_user() && $block) {
|
||||
notice('Permission denied.' . EOL);
|
||||
notice(L10n::t('Permission denied.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
$user = DBA::selectFirst('user', ['parent-uid'], ['uid' => local_user()]);
|
||||
if (!empty($user['parent-uid'])) {
|
||||
notice('Only parent users can create additional profiles.');
|
||||
notice(L10n::t('Only parent users can create additional profiles.'));
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!local_user() && (intval(Config::get('config', 'register_policy')) === self::CLOSED)) {
|
||||
notice('Permission denied.' . EOL);
|
||||
notice(L10n::t('Permission denied.'));
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ class Register extends BaseModule
|
|||
$count = DBA::count('user', ['`register_date` > UTC_TIMESTAMP - INTERVAL 1 day']);
|
||||
if ($count >= $max_dailies) {
|
||||
Logger::log('max daily registrations exceeded.');
|
||||
notice(L10n::t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
|
||||
notice(L10n::t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -177,19 +177,19 @@ class Register extends BaseModule
|
|||
$additional_account = false;
|
||||
|
||||
if (!local_user() && !empty($arr['post']['parent_password'])) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
notice(L10n::t('Permission denied.'));
|
||||
return;
|
||||
} elseif (local_user() && !empty($arr['post']['parent_password'])) {
|
||||
try {
|
||||
Model\User::getIdFromPasswordAuthentication(local_user(), $arr['post']['parent_password']);
|
||||
} catch (\Exception $ex) {
|
||||
notice(L10n::t("Password doesn't match"));
|
||||
notice(L10n::t("Password doesn't match."));
|
||||
$regdata = ['nickname' => $arr['post']['nickname'], 'username' => $arr['post']['username']];
|
||||
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
||||
}
|
||||
$additional_account = true;
|
||||
} elseif (local_user()) {
|
||||
notice(L10n::t('Please enter your password'));
|
||||
notice(L10n::t('Please enter your password.'));
|
||||
$regdata = ['nickname' => $arr['post']['nickname'], 'username' => $arr['post']['username']];
|
||||
DI::baseUrl()->redirect('register?' . http_build_query($regdata));
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class Register extends BaseModule
|
|||
case self::CLOSED:
|
||||
default:
|
||||
if (empty($_SESSION['authenticated']) && empty($_SESSION['administrator'])) {
|
||||
\notice(L10n::t('Permission denied.') . EOL);
|
||||
notice(L10n::t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
$blocked = 1;
|
||||
|
@ -242,7 +242,7 @@ class Register extends BaseModule
|
|||
if ($additional_account) {
|
||||
$user = DBA::selectFirst('user', ['email'], ['uid' => local_user()]);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice(L10n::t('User not found'));
|
||||
notice(L10n::t('User not found.'));
|
||||
DI::baseUrl()->redirect('register');
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ class Register extends BaseModule
|
|||
try {
|
||||
$result = Model\User::create($arr);
|
||||
} catch (\Exception $e) {
|
||||
\notice($e->getMessage());
|
||||
notice($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -307,29 +307,29 @@ class Register extends BaseModule
|
|||
);
|
||||
|
||||
if ($res) {
|
||||
\info(L10n::t('Registration successful. Please check your email for further instructions.') . EOL);
|
||||
info(L10n::t('Registration successful. Please check your email for further instructions.'));
|
||||
DI::baseUrl()->redirect();
|
||||
} else {
|
||||
\notice(
|
||||
notice(
|
||||
L10n::t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
|
||||
$user['email'],
|
||||
$result['password'])
|
||||
);
|
||||
}
|
||||
} else {
|
||||
\info(L10n::t('Registration successful.') . EOL);
|
||||
info(L10n::t('Registration successful.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
} elseif (intval(Config::get('config', 'register_policy')) === self::APPROVE) {
|
||||
if (!strlen(Config::get('config', 'admin_email'))) {
|
||||
\notice(L10n::t('Your registration can not be processed.') . EOL);
|
||||
notice(L10n::t('Your registration can not be processed.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
// Check if the note to the admin is actually filled out
|
||||
if (empty($_POST['permonlybox'])) {
|
||||
\notice(L10n::t('You have to leave a request note for the admin.')
|
||||
. L10n::t('Your registration can not be processed.') . EOL);
|
||||
notice(L10n::t('You have to leave a request note for the admin.')
|
||||
. L10n::t('Your registration can not be processed.'));
|
||||
|
||||
DI::baseUrl()->redirect('register/');
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ class Register extends BaseModule
|
|||
$result['password']
|
||||
);
|
||||
|
||||
\info(L10n::t('Your registration is pending approval by the site owner.') . EOL);
|
||||
info(L10n::t('Your registration is pending approval by the site owner.'));
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user