Browse Source

fix: Unable to login with username if it contains uppercase characters

Owen Diffey 2 years ago
parent
commit
29ae27d697
1 changed files with 2 additions and 7 deletions
  1. 2 7
      backend/logic/actions/users.js

+ 2 - 7
backend/logic/actions/users.js

@@ -775,13 +775,8 @@ export default {
 				next => {
 					const query = {};
 					if (identifier.indexOf("@") !== -1) query["email.address"] = identifier;
-					else query.username = identifier;
-					userModel.findOne(
-						{
-							$or: [query]
-						},
-						next
-					);
+					else query.username = { $regex: `^${identifier}$`, $options: "i" };
+					userModel.findOne(query, next);
 				},
 
 				// if the user doesn't exist, respond with a failure