MDL-34685 auth Allow auth plugins to override user signup form

This commit is contained in:
Michael Aherne 2012-08-01 15:23:05 +01:00 committed by Dan Poltawski
parent 7b3c1c9d8c
commit 57d38adc58
3 changed files with 15 additions and 3 deletions

View File

@ -8,6 +8,8 @@ required changes in code:
* use role_get_name() or role_fix_names() if you need any role names, using role.name
directly from database is not correct any more
optional - no changes needed:
* add support for custom user signup form - see auth_plugin_base::signup_form() function
=== 2.2 ===

View File

@ -278,6 +278,18 @@ class auth_plugin_base {
//override when can signup
print_error('mustbeoveride', 'debug', '', 'user_signup()' );
}
/**
* Return a form to capture user details for account creation.
* This is used in /login/signup.php.
* @return moodle_form A form which edits a record from the user table.
*/
function signup_form() {
global $CFG;
require_once($CFG->dirroot.'/login/signup_form.php');
return new login_signup_form(null, null, 'post', '', array('autocomplete'=>'on'));
}
/**
* Returns true if plugin allows confirming of new users.

View File

@ -25,8 +25,6 @@
*/
require('../config.php');
require_once('signup_form.php');
if (empty($CFG->registerauth)) {
print_error('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.');
@ -43,7 +41,7 @@ $PAGE->https_required();
$PAGE->set_url('/login/signup.php');
$PAGE->set_context(context_system::instance());
$mform_signup = new login_signup_form(null, null, 'post', '', array('autocomplete'=>'on'));
$mform_signup = $authplugin->signup_form();
if ($mform_signup->is_cancelled()) {
redirect(get_login_url());