Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Commit

Permalink
fix(user): invalid regex in login
Browse files Browse the repository at this point in the history
close #634
  • Loading branch information
Enkhtuvshin0513 authored and batamar committed Nov 20, 2019
1 parent 7a696d4 commit 6cc2dc0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/db/models/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,10 @@ export const loadClass = () => {
deviceToken?: string;
}) {
const user = await Users.findOne({
$or: [{ email: { $regex: new RegExp(email, 'i') } }, { username: { $regex: new RegExp(email, 'i') } }],
$or: [
{ email: { $regex: new RegExp(`^${email}$`, 'i') } },
{ username: { $regex: new RegExp(`^${email}$`, 'i') } },
],
isActive: true,
});

Expand Down

0 comments on commit 6cc2dc0

Please sign in to comment.