mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
fix(script): better dupe matching
This commit is contained in:
@@ -35,15 +35,14 @@ async function deleteAmplitudeData (userId, email) {
|
|||||||
|
|
||||||
async function deleteHabiticaData (user, email) {
|
async function deleteHabiticaData (user, email) {
|
||||||
const truncatedEmail = email.slice(0, email.indexOf('@'));
|
const truncatedEmail = email.slice(0, email.indexOf('@'));
|
||||||
|
const set = {
|
||||||
|
'auth.local.hashed_password': '$2a$10$QDnNh1j1yMPnTXDEOV38xOePEWFd4X8DSYwAM8XTmqmacG5X0DKjW',
|
||||||
|
'auth.local.passwordHashMethod': 'bcrypt',
|
||||||
|
};
|
||||||
|
if (!user.auth.local.email) set['auth.local.email'] = `${truncatedEmail}@example.com`;
|
||||||
await User.update(
|
await User.update(
|
||||||
{ _id: user._id },
|
{ _id: user._id },
|
||||||
{
|
{ $set: set },
|
||||||
$set: {
|
|
||||||
'auth.local.email': user.auth.local.email ? email : `${truncatedEmail}@example.com`,
|
|
||||||
'auth.local.hashed_password': '$2a$10$QDnNh1j1yMPnTXDEOV38xOePEWFd4X8DSYwAM8XTmqmacG5X0DKjW',
|
|
||||||
'auth.local.passwordHashMethod': 'bcrypt',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
const response = await axios.delete(
|
const response = await axios.delete(
|
||||||
`${BASE_URL}/api/v3/user`,
|
`${BASE_URL}/api/v3/user`,
|
||||||
@@ -78,6 +77,7 @@ async function processEmailAddress (email) {
|
|||||||
|
|
||||||
const socialUsers = await User.find(
|
const socialUsers = await User.find(
|
||||||
{
|
{
|
||||||
|
'auth.local.email': {$not: emailRegex},
|
||||||
$or: [
|
$or: [
|
||||||
{ 'auth.facebook.emails.value': email },
|
{ 'auth.facebook.emails.value': email },
|
||||||
{ 'auth.google.emails.value': email },
|
{ 'auth.google.emails.value': email },
|
||||||
|
|||||||
Reference in New Issue
Block a user