This commit is contained in:
Dan Poltawski 2015-08-17 15:03:59 +01:00
commit cfeadc66b0
6 changed files with 18 additions and 5 deletions

View File

@ -80,6 +80,9 @@ if ($hassiteconfig) {
$temp->add(new admin_setting_heading('manageauthscommonheading', new lang_string('commonsettings', 'admin'), ''));
$temp->add(new admin_setting_special_registerauth());
$temp->add(new admin_setting_configcheckbox('authloginviaemail', new lang_string('authloginviaemail', 'core_auth'), new lang_string('authloginviaemail_desc', 'core_auth'), 0));
$temp->add(new admin_setting_configcheckbox('allowuserstoshareemailaddresses',
new lang_string('allowuserstoshareemailaddresses', 'core_auth'),
new lang_string('allowuserstoshareemailaddresses_desc', 'core_auth'), 0));
$temp->add(new admin_setting_configcheckbox('authpreventaccountcreation', new lang_string('authpreventaccountcreation', 'admin'), new lang_string('authpreventaccountcreation_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('loginpageautofocus', new lang_string('loginpageautofocus', 'admin'), new lang_string('loginpageautofocus_help', 'admin'), 0));
$temp->add(new admin_setting_configselect('guestloginbutton', new lang_string('guestloginbutton', 'auth'),

View File

@ -168,7 +168,7 @@ if ($formdata = $mform2->is_cancelled()) {
$allowdeletes = (!empty($formdata->uuallowdeletes) and $optype != UU_USER_ADDNEW and $optype != UU_USER_ADDINC);
$allowsuspends = (!empty($formdata->uuallowsuspends));
$bulk = $formdata->uubulk;
$noemailduplicates = $formdata->uunoemailduplicates;
$noemailduplicates = empty($CFG->allowuserstoshareemailaddresses) ? 1 : $formdata->uunoemailduplicates;
$standardusernames = $formdata->uustandardusernames;
$resetpasswords = isset($formdata->uuforcepasswordchange) ? $formdata->uuforcepasswordchange : UU_PWRESET_NONE;

View File

@ -138,8 +138,13 @@ class admin_uploaduser_form2 extends moodleform {
$mform->disabledIf('uuallowsuspends', 'uutype', 'eq', UU_USER_ADDNEW);
$mform->disabledIf('uuallowsuspends', 'uutype', 'eq', UU_USER_ADDINC);
$mform->addElement('selectyesno', 'uunoemailduplicates', get_string('uunoemailduplicates', 'tool_uploaduser'));
$mform->setDefault('uunoemailduplicates', 1);
if (!empty($CFG->allowuserstoshareemailaddresses)) {
$mform->addElement('selectyesno', 'uunoemailduplicates', get_string('uunoemailduplicates', 'tool_uploaduser'));
$mform->setDefault('uunoemailduplicates', 1);
} else {
$mform->addElement('hidden', 'uunoemailduplicates', 1);
}
$mform->setType('uunoemailduplicates', PARAM_BOOL);
$mform->addElement('selectyesno', 'uustandardusernames', get_string('uustandardusernames', 'tool_uploaduser'));
$mform->setDefault('uustandardusernames', 1);

View File

@ -114,6 +114,8 @@ $string['limitconcurrentlogins_desc'] = 'If enabled the number of concurrent bro
$string['locked'] = 'Locked';
$string['authloginviaemail'] = 'Allow log in via email';
$string['authloginviaemail_desc'] = 'Allow users to use both username and email address (if unique) for site login.';
$string['allowuserstoshareemailaddresses'] = 'Allow users to share email addresses';
$string['allowuserstoshareemailaddresses_desc'] = 'Allow different user accounts to share the same email address. It is important to ensure that this will not cause any unexpected security issues in your setup before enabling it. For example, password change confirmations will be sent to the shared email address.';
$string['md5'] = 'MD5 hash';
$string['nopasswordchange'] = 'Password can not be changed';
$string['nopasswordchangeforced'] = 'You cannot proceed without changing your password, however there is no available page for changing it. Please contact your Moodle Administrator.';

View File

@ -174,7 +174,9 @@ class user_edit_form extends moodleform {
// Mail not confirmed yet.
} else if (!validate_email($usernew->email)) {
$errors['email'] = get_string('invalidemail');
} else if (($usernew->email !== $user->email) and $DB->record_exists('user', array('email' => $usernew->email, 'mnethostid' => $CFG->mnet_localhost_id))) {
} else if (($usernew->email !== $user->email)
and empty($CFG->allowuserstoshareemailaddresses)
and $DB->record_exists('user', array('email' => $usernew->email, 'mnethostid' => $CFG->mnet_localhost_id))) {
$errors['email'] = get_string('emailexists');
}

View File

@ -262,7 +262,8 @@ class user_editadvanced_form extends moodleform {
if (!$user or $user->email !== $usernew->email) {
if (!validate_email($usernew->email)) {
$err['email'] = get_string('invalidemail');
} else if ($DB->record_exists('user', array('email' => $usernew->email, 'mnethostid' => $CFG->mnet_localhost_id))) {
} else if (empty($CFG->allowuserstoshareemailaddresses)
and $DB->record_exists('user', array('email' => $usernew->email, 'mnethostid' => $CFG->mnet_localhost_id))) {
$err['email'] = get_string('emailexists');
}
}