3 require_once('../config.php');
6 * Returns whether or not the captcha element is enabled, and the admin settings fulfil its requirements.
9 function signup_captcha_enabled() {
11 return !empty($CFG->recaptchapublickey
) && !empty($CFG->recaptchaprivatekey
) && get_config('auth/email', 'recaptcha');
14 require_once('signup_form.php');
17 if (empty($CFG->registerauth
)) {
18 error("Sorry, you may not use this page.");
20 $authplugin = get_auth_plugin($CFG->registerauth
);
22 if (!$authplugin->can_signup()) {
23 error("Sorry, you may not use this page.");
26 //HTTPS is potentially required in this page
29 $mform_signup = new login_signup_form();
31 if ($mform_signup->is_cancelled()) {
32 redirect($CFG->httpswwwroot
.'/login/index.php');
34 } else if ($user = $mform_signup->get_data()) {
36 $user->lang
= current_language();
37 $user->firstaccess
= time();
38 $user->mnethostid
= $CFG->mnet_localhost_id
;
39 $user->secret
= random_string(15);
40 $user->auth
= $CFG->registerauth
;
42 $authplugin->user_signup($user, true); // prints notice and link to login/index.php
46 $newaccount = get_string('newaccount');
47 $login = get_string('login');
49 if (empty($CFG->langmenu
)) {
52 $currlang = current_language();
53 $langs = get_list_of_languages();
54 $langmenu = popup_form ("$CFG->wwwroot/login/signup.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
58 $navlinks[] = array('name' => $login, 'link' => "index.php", 'type' => 'misc');
59 $navlinks[] = array('name' => $newaccount, 'link' => null, 'type' => 'misc');
60 $navigation = build_navigation($navlinks);
61 print_header($newaccount, $newaccount, $navigation, $mform_signup->focus(), "", true, "<div class=\"langmenu\">$langmenu</div>");
63 $mform_signup->display();