Commit fb330e38 authored by Robert Lyon's avatar Robert Lyon

Bug 1567100: In Mahara we deal with username in a case insensitive way

In other places we check the LOWER(username) but for some reason
in find_by_username() we don't. We should do it here as well for
consistency.

behatnotneeded

Change-Id: Ie692aeace0c8aa2f6989683e094ac6625f153b98
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 750cc62c
...@@ -134,6 +134,7 @@ class User { ...@@ -134,6 +134,7 @@ class User {
throw new InvalidArgumentException('username parameter must be a string to create a User object'); throw new InvalidArgumentException('username parameter must be a string to create a User object');
} }
$username = strtolower($username);
$sql = 'SELECT $sql = 'SELECT
*, *,
' . db_format_tsfield('expiry') . ', ' . db_format_tsfield('expiry') . ',
...@@ -145,7 +146,7 @@ class User { ...@@ -145,7 +146,7 @@ class User {
FROM FROM
{usr} {usr}
WHERE WHERE
username = ?'; LOWER(username) = ?';
$user = get_record_sql($sql, array($username)); $user = get_record_sql($sql, array($username));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment