Skip to content

Commit

Permalink
Merge branch 'MDL-35104-master-2' of git://github.com/cameron1729/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jun 21, 2016
2 parents 8a46580 + 8c2b696 commit b3f25cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lang/en/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,5 @@
$string['update_onupdate'] = 'On update';
$string['user_activatenotsupportusertype'] = 'auth: ldap user_activate() does not support selected usertype: {$a}';
$string['user_disablenotsupportusertype'] = 'auth: ldap user_disable() does not support selected usertype (..yet)';
$string['username'] = 'Username';
$string['username_help'] = 'Please be aware that some authentication plugins will not allow you to change the username.';
16 changes: 12 additions & 4 deletions user/editadvanced_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,19 @@ public function definition() {
// Print the required moodle fields first.
$mform->addElement('header', 'moodle', $strgeneral);

$mform->addElement('text', 'username', get_string('username'), 'size="20"');
$mform->addRule('username', $strrequired, 'required', null, 'client');
$mform->setType('username', core_user::get_property_type('username'));

$auths = core_component::get_plugin_list('auth');
$enabled = get_string('pluginenabled', 'core_plugin');
$disabled = get_string('plugindisabled', 'core_plugin');
$authoptions = array($enabled => array(), $disabled => array());
$cannotchangepass = array();
$cannotchangeusername = array();
foreach ($auths as $auth => $unused) {
$authinst = get_auth_plugin($auth);

if (!$authinst->is_internal()) {
$cannotchangeusername[] = $auth;
}

$passwordurl = $authinst->change_password_url();
if (!($authinst->can_change_password() && empty($passwordurl))) {
if ($userid < 1 and $authinst->is_internal()) {
Expand All @@ -93,6 +95,12 @@ public function definition() {
$authoptions[$disabled][$auth] = get_string('pluginname', "auth_{$auth}");
}
}

$mform->addElement('text', 'username', get_string('username'), 'size="20"');
$mform->addHelpButton('username', 'username', 'auth');
$mform->setType('username', core_user::get_property_type('username'));
$mform->disabledIf('username', 'auth', 'in', $cannotchangeusername);

$mform->addElement('selectgroups', 'auth', get_string('chooseauthmethod', 'auth'), $authoptions);
$mform->addHelpButton('auth', 'chooseauthmethod', 'auth');

Expand Down

0 comments on commit b3f25cb

Please sign in to comment.