Exemplo n.º 1
0
function signup_captcha_enabled()
{
    global $CFG;
    return !empty($CFG->recaptchapublickey) && !empty($CFG->recaptchaprivatekey) && get_config('auth/email', 'recaptcha');
}
require_once 'signup_form.php';
if (empty($CFG->registerauth)) {
    print_error("Sorry, you may not use this page.");
}
$authplugin = get_auth_plugin($CFG->registerauth);
if (!$authplugin->can_signup()) {
    print_error("Sorry, you may not use this page.");
}
//HTTPS is potentially required in this page
httpsrequired();
$mform_signup = new login_signup_form();
if ($mform_signup->is_cancelled()) {
    redirect(get_login_url());
} else {
    if ($user = $mform_signup->get_data()) {
        $user->confirmed = 0;
        $user->lang = current_language();
        $user->firstaccess = time();
        $user->mnethostid = $CFG->mnet_localhost_id;
        $user->secret = random_string(15);
        $user->auth = $CFG->registerauth;
        $authplugin->user_signup($user, true);
        // prints notice and link to login/index.php
        exit;
        //never reached
    }
Exemplo n.º 2
0
<?php

// $Id: signup.php,v 1.52.2.3 2007/03/22 12:40:24 skodak Exp $
require_once '../config.php';
require_once 'signup_form.php';
if (empty($CFG->registerauth)) {
    error("Sorry, you may not use this page.");
}
$authplugin = get_auth_plugin($CFG->registerauth);
if (!$authplugin->can_signup()) {
    error("Sorry, you may not use this page.");
}
//HTTPS is potentially required in this page
httpsrequired();
$mform_signup = new login_signup_form();
if ($mform_signup->is_cancelled()) {
    redirect($CFG->httpswwwroot . '/login/index.php');
} else {
    if ($user = $mform_signup->get_data()) {
        $user->confirmed = 0;
        $user->lang = current_language();
        $user->firstaccess = time();
        $user->mnethostid = $CFG->mnet_localhost_id;
        $user->secret = random_string(15);
        $user->auth = $CFG->registerauth;
        $authplugin->user_signup($user, true);
        // prints notice and link to login/index.php
        exit;
        //never reached
    }
}
Exemplo n.º 3
0
function local_send_confirmation_email($user)
{
    global $CFG, $USER;
    if (function_exists('login_signup_form')) {
        $mform_signup = new login_signup_form();
        $formdata = $mform_signup->get_data();
    }
    $site = get_site();
    $sitecontext = get_context_instance(CONTEXT_SYSTEM);
    $data = new object();
    $data->firstname = fullname($user);
    $data->sitename = format_string($site->fullname);
    $data->admin = generate_email_signoff();
    $data->custommsg = '';
    $invite = false;
    if (isloggedin() && has_capability('moodle/local:invitenewuser', $sitecontext)) {
        $supportuser = $USER;
        $data->fromuser = fullname($supportuser);
        $invite = true;
    } else {
        $supportuser = generate_email_supportuser();
    }
    if (!empty($formdata->message)) {
        $data->custommsg = $formdata->message;
    }
    $subject = get_string('emailconfirmationsubject', '', format_string($site->fullname));
    if ($invite) {
        $data->link = $CFG->wwwroot . '/local/login/confirm.php?data=' . $user->secret . '/' . urlencode($user->username);
        $message = get_string('emailconfirmation', 'block_tao_team_groups', $data);
    } else {
        $data->link = $CFG->wwwroot . '/login/confirm.php?data=' . $user->secret . '/' . urlencode($user->username);
        $message = get_string('emailconfirmation', 'block_tao_team_groups', $data);
    }
    $messagehtml = text_to_html($message, false, false, true);
    $user->mailformat = 1;
    // Always send HTML version as well
    return email_to_user($user, $supportuser, $subject, $message, $messagehtml);
}
Exemplo n.º 4
0
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require '../config.php';
require_once 'signup_form.php';
if (empty($CFG->registerauth)) {
    print_error('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.');
}
$authplugin = get_auth_plugin($CFG->registerauth);
if (!$authplugin->can_signup()) {
    print_error('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.');
}
//HTTPS is required in this page when $CFG->loginhttps enabled
$PAGE->https_required();
$PAGE->set_url('/login/signup.php');
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
$mform_signup = new login_signup_form();
if ($mform_signup->is_cancelled()) {
    redirect(get_login_url());
} else {
    if ($user = $mform_signup->get_data()) {
        $user->confirmed = 0;
        $user->lang = current_language();
        $user->firstaccess = time();
        $user->timecreated = time();
        $user->mnethostid = $CFG->mnet_localhost_id;
        $user->secret = random_string(15);
        $user->auth = $CFG->registerauth;
        $authplugin->user_signup($user, true);
        // prints notice and link to login/index.php
        exit;
        //never reached