Skip to content

Commit

Permalink
Merge branch 'wip-MDL-29093-master' of git://github.com/samhemelryk/m…
Browse files Browse the repository at this point in the history
…oodle
  • Loading branch information
stronk7 committed Sep 13, 2011
2 parents 148c65b + 2c7a914 commit cdcb1b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions admin/settings/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
$temp->add(new admin_setting_manageauths());
$temp->add(new admin_setting_heading('manageauthscommonheading', get_string('commonsettings', 'admin'), ''));
$temp->add(new admin_setting_special_registerauth());
$temp->add(new admin_setting_configcheckbox('authpreventaccountcreation', get_string('authpreventaccountcreation', 'admin'), get_string('authpreventaccountcreation_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('loginpageautofocus', get_string('loginpageautofocus', 'admin'), get_string('loginpageautofocus_help', 'admin'), 0));
$temp->add(new admin_setting_configselect('guestloginbutton', get_string('guestloginbutton', 'auth'),
get_string('showguestlogin', 'auth'), '1', array('0'=>get_string('hide'), '1'=>get_string('show'))));
Expand Down
2 changes: 2 additions & 0 deletions lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
$string['appearance'] = 'Appearance';
$string['aspellpath'] = 'Path to aspell';
$string['authentication'] = 'Authentication';
$string['authpreventaccountcreation'] = 'Prevent account creation when authenticating';
$string['authpreventaccountcreation_help'] = 'When a user authenticates, if they do not yet have an account on the site, usually one will be automatically created for them. It may be that you wish to authenticate using an external system, but you wish to restrict access to the site to users with an existing account only. With this option enabled, only existing users will be able to gain access after they are authenticated via the external system. New accounts will need to be created manually or via the upload users feature.';
$string['authsettings'] = 'Manage authentication';
$string['autolang'] = 'Language autodetect';
$string['autologinguests'] = 'Auto-login guests';
Expand Down
8 changes: 6 additions & 2 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3769,8 +3769,12 @@ function authenticate_user_login($username, $password) {
$user = update_user_record($username);
}
} else {
// if user not found, create him
$user = create_user_record($username, $password, $auth);
// if user not found and user creation is not disabled, create it
if (empty($CFG->authpreventaccountcreation)) {
$user = create_user_record($username, $password, $auth);
} else {
continue;
}
}

$authplugin->sync_roles($user);
Expand Down

0 comments on commit cdcb1b9

Please sign in to comment.