mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 11:36:45 +00:00
fix(script): don't use extremely costly regex
This commit is contained in:
parent
9bfb2afd9c
commit
ec78831a81
1 changed files with 2 additions and 3 deletions
|
|
@ -71,15 +71,14 @@ async function deleteHabiticaData (user, email) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function processEmailAddress (email) {
|
async function processEmailAddress (email) {
|
||||||
const emailRegex = new RegExp(`^${email}$`, 'i');
|
|
||||||
const localUsers = await User.find(
|
const localUsers = await User.find(
|
||||||
{ 'auth.local.email': emailRegex },
|
{ 'auth.local.email': email },
|
||||||
{ _id: 1, apiToken: 1, auth: 1 },
|
{ _id: 1, apiToken: 1, auth: 1 },
|
||||||
).exec();
|
).exec();
|
||||||
|
|
||||||
const socialUsers = await User.find(
|
const socialUsers = await User.find(
|
||||||
{
|
{
|
||||||
'auth.local.email': { $not: emailRegex },
|
'auth.local.email': { $ne: email },
|
||||||
$or: [
|
$or: [
|
||||||
{ 'auth.facebook.emails.value': email },
|
{ 'auth.facebook.emails.value': email },
|
||||||
{ 'auth.google.emails.value': email },
|
{ 'auth.google.emails.value': email },
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue