fix: Remove username from email verification and password reset process (#8488)

BREAKING CHANGE: This removes the username from the email verification and password reset process to prevent storing personally identifiable information (PII) in server and infrastructure logs. Customized HTML pages or emails related to email verification and password reset may need to be adapted accordingly. See the new templates that come bundled with Parse Server and the [migration guide](https://github.com/parse-community/parse-server/blob/alpha/8.0.0.md) for more details.
This commit is contained in:
Daniel
2025-03-02 12:32:43 +11:00
committed by GitHub
parent 6a6bc2a8cc
commit d21dd97336
21 changed files with 401 additions and 308 deletions

View File

@@ -227,65 +227,55 @@ beforeAll(async () => {
Parse.serverURL = 'http://localhost:' + port + '/1';
});
afterEach(function (done) {
const afterLogOut = async () => {
// Jasmine process uses one connection
if (Object.keys(openConnections).length > 1) {
console.warn(`There were ${Object.keys(openConnections).length} open connections to the server left after the test finished`);
}
await TestUtils.destroyAllDataPermanently(true);
SchemaCache.clear();
if (didChangeConfiguration) {
await reconfigureServer();
} else {
await databaseAdapter.performInitialization({ VolatileClassesSchemas });
}
done();
};
global.afterEachFn = async () => {
Parse.Cloud._removeAllHooks();
Parse.CoreManager.getLiveQueryController().setDefaultLiveQueryClient();
defaults.protectedFields = { _User: { '*': ['email'] } };
databaseAdapter
.getAllClasses()
.then(allSchemas => {
allSchemas.forEach(schema => {
const className = schema.className;
expect(className).toEqual({
asymmetricMatch: className => {
if (!className.startsWith('_')) {
return true;
} else {
// Other system classes will break Parse.com, so make sure that we don't save anything to _SCHEMA that will
// break it.
return (
[
'_User',
'_Installation',
'_Role',
'_Session',
'_Product',
'_Audience',
'_Idempotency',
].indexOf(className) >= 0
);
}
},
});
});
})
.then(() => Parse.User.logOut())
.then(
() => {},
() => {}
) // swallow errors
.then(() => {
// Connection close events are not immediate on node 10+... wait a bit
return new Promise(resolve => {
setTimeout(resolve, 0);
});
})
.then(afterLogOut);
});
const allSchemas = await databaseAdapter.getAllClasses().catch(() => []);
allSchemas.forEach(schema => {
const className = schema.className;
expect(className).toEqual({
asymmetricMatch: className => {
if (!className.startsWith('_')) {
return true;
}
return [
'_User',
'_Installation',
'_Role',
'_Session',
'_Product',
'_Audience',
'_Idempotency',
].includes(className);
},
});
});
await Parse.User.logOut().catch(() => {});
// Connection close events are not immediate on node 10+, so wait a bit
await new Promise(resolve => setTimeout(resolve, 0));
// After logout operations
if (Object.keys(openConnections).length > 1) {
console.warn(
`There were ${Object.keys(openConnections).length} open connections to the server left after the test finished`
);
}
await TestUtils.destroyAllDataPermanently(true);
SchemaCache.clear();
if (didChangeConfiguration) {
await reconfigureServer();
} else {
await databaseAdapter.performInitialization({ VolatileClassesSchemas });
}
}
afterEach(global.afterEachFn);
afterAll(() => {
global.displayTestStats();