Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions classes/loginflow/authcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,8 @@ protected function handlelogin(string $oidcuniqid, array $authparams, array $tok
// Handle username change - update token, update connection.
if ($usernamechanged) {
$potentialduplicateuser = core_user::get_user_by_username($oidcusername);
if ($potentialduplicateuser) {
// Username already exists, cannot change Moodle account username, throw exception.
if ($potentialduplicateuser->id!=$tokenrec->userid) {
// Username already exists in another user, cannot change Moodle account username, throw exception.
throw new moodle_exception('erroruserwithusernamealreadyexists', 'auth_oidc', null, null, '2');
} else {
// Username does not exist:
Expand Down
2 changes: 1 addition & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function auth_oidc_get_tokens_with_mismatched_usernames() {
FROM {auth_oidc_token} tok
JOIN {user} u ON u.id = tok.userid
WHERE tok.userid != 0
AND u.username != tok.username';
AND u.username COLLATE utf8mb4_general_ci != tok.username COLLATE utf8mb4_general_ci';
$records = $DB->get_recordset_sql($sql);
foreach ($records as $record) {
$item = new stdClass();
Expand Down