display user welcome message

main
msquare 8 years ago
parent a083c198bb
commit 6384eca1ce

@ -14,10 +14,11 @@ function logout_title() {
// Engel registrieren // Engel registrieren
function guest_register() { function guest_register() {
global $tshirt_sizes, $enable_tshirt_size, $default_theme; global $tshirt_sizes, $enable_tshirt_size, $default_theme, $user;
$event_config = EventConfig(); $event_config = EventConfig();
return User_registration_success_view($event_config['event_welcome_msg']); if ($event_config === false)
engelsystem_error("Unable to load event config.");
$msg = ""; $msg = "";
$nick = ""; $nick = "";
@ -168,6 +169,16 @@ function guest_register() {
engelsystem_log("User " . User_Nick_render(User($user_id)) . " signed up as: " . join(", ", $user_angel_types_info)); engelsystem_log("User " . User_Nick_render(User($user_id)) . " signed up as: " . join(", ", $user_angel_types_info));
success(_("Angel registration successful!")); success(_("Angel registration successful!"));
// User is already logged in - that means a coordinator has registered an angel. Return to register page.
if (isset($user)) {
redirect(page_link_to('register'));
}
// If a welcome message is present, display registration success page.
if ($event_config != null && $event_config['event_welcome_msg'] != null) {
return User_registration_success_view($event_config['event_welcome_msg']);
}
redirect('?'); redirect('?');
} }
} }
@ -295,41 +306,45 @@ function guest_login() {
} }
} }
if (in_array('register', $privileges)) { return page_with_title(login_title(), [
$register_hint = join('', array(
'<p>' . _("Please sign up, if you want to help us!") . '</p>',
buttons(array(
button(page_link_to('register'), register_title() . ' &raquo;')
))
));
} else {
$register_hint = join('', array(
error(_('Registration is disabled.'), true)
));
}
return page_with_title(login_title(), array(
msg(), msg(),
'<div class="row"><div class="col-md-6">', div('row', [
form(array( div('col-md-6', [
form([
form_text('nick', _("Nick"), $nick), form_text('nick', _("Nick"), $nick),
form_password('password', _("Password")), form_password('password', _("Password")),
form_submit('submit', _("Login")), form_submit('submit', _("Login")),
buttons(array( buttons([
button(page_link_to('user_password_recovery'), _("I forgot my password")) button(page_link_to('user_password_recovery'), _("I forgot my password"))
)), ]),
info(_("Please note: You have to activate cookies!"), true) info(_("Please note: You have to activate cookies!"), true)
)), ])
'</div>', ]),
'<div class="col-md-6">', div('col-md-6', [
'<h2>' . register_title() . '</h2>', '<h2>' . register_title() . '</h2>',
$register_hint, get_register_hint(),
'<h2>' . _("What can I do?") . '</h2>', '<h2>' . _("What can I do?") . '</h2>',
'<p>' . _("Please read about the jobs you can do to help us.") . '</p>', '<p>' . _("Please read about the jobs you can do to help us.") . '</p>',
buttons(array( buttons([
button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' &raquo;') button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' &raquo;')
)), ])
'</div></div>' ])
)); ])
]);
}
function get_register_hint() {
global $privileges;
if (in_array('register', $privileges)) {
return join('', [
'<p>' . _("Please sign up, if you want to help us!") . '</p>',
buttons([
button(page_link_to('register'), register_title() . ' &raquo;')
])
]);
}
return error(_("Registration is disabled."), true);
} }
?> ?>

@ -25,8 +25,32 @@ $tshirt_sizes = array(
function User_registration_success_view($event_welcome_message) { function User_registration_success_view($event_welcome_message) {
$parsedown = new Parsedown(); $parsedown = new Parsedown();
$event_welcome_message = $parsedown->text($event_welcome_message); $event_welcome_message = $parsedown->text($event_welcome_message);
return page_with_title(_("Welcome to the engelsystem!"), [ return page_with_title(_("Registration successful"), [
msg(),
div('row', [
div('col-md-4', [
$event_welcome_message $event_welcome_message
]),
div('col-md-4', [
'<h2>' . _("Login") . '</h2>',
form([
form_text('nick', _("Nick"), ""),
form_password('password', _("Password")),
form_submit('submit', _("Login")),
buttons([
button(page_link_to('user_password_recovery'), _("I forgot my password"))
]),
info(_("Please note: You have to activate cookies!"), true)
], page_link_to('login'))
]),
div('col-md-4', [
'<h2>' . _("What can I do?") . '</h2>',
'<p>' . _("Please read about the jobs you can do to help us.") . '</p>',
buttons([
button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' &raquo;')
])
])
])
]); ]);
} }

Loading…
Cancel
Save