mirror of
https://github.com/PretendoNetwork/account.git
synced 2026-09-09 11:57:32 -05:00
Added PNID.scrub method to remove personal information
This commit is contained in:
@@ -217,4 +217,56 @@ PNIDSchema.method('getServerMode', function getServerMode(): string {
|
||||
return this.get('server_mode') || 'prod';
|
||||
});
|
||||
|
||||
PNIDSchema.method('scrub', function scrub() {
|
||||
// * Remove all personal info from a PNID
|
||||
// * Username and PID remain so thye do not get assigned again
|
||||
this.creation_date = '';
|
||||
this.password = '';
|
||||
this.birthdate = '';
|
||||
this.gender = '';
|
||||
this.country = '';
|
||||
this.language = '';
|
||||
this.email = {
|
||||
address: '',
|
||||
primary: false,
|
||||
parent: false,
|
||||
reachable: false,
|
||||
validated: false,
|
||||
validated_date: '',
|
||||
id: 0
|
||||
};
|
||||
this.region = 0;
|
||||
this.timezone = {
|
||||
name: '',
|
||||
offset: 0
|
||||
};
|
||||
this.mii = {
|
||||
name: 'Default',
|
||||
primary: false,
|
||||
data: 'AwAAQOlVognnx0GC2/uogAOzuI0n2QAAAEBEAGUAZgBhAHUAbAB0AAAAAAAAAEBAAAAhAQJoRBgmNEYUgRIXaA0AACkAUkhQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGm9',
|
||||
id: 0,
|
||||
hash: '',
|
||||
image_url: '',
|
||||
image_id: 0
|
||||
};
|
||||
this.flags = {
|
||||
active: false,
|
||||
marketing: false,
|
||||
off_device: false
|
||||
};
|
||||
this.connections = {
|
||||
discord: {
|
||||
id: ''
|
||||
},
|
||||
stripe: {
|
||||
customer_id: '',
|
||||
subscription_id: '',
|
||||
price_id: '',
|
||||
tier_level: 0,
|
||||
tier_name: '',
|
||||
latest_webhook_timestamp: 0
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
export const PNID: PNIDModel = model<IPNID, PNIDModel>('PNID', PNIDSchema);
|
||||
@@ -523,6 +523,10 @@ router.put('/@me/deletion', async (request: express.Request, response: express.R
|
||||
}).end());
|
||||
}
|
||||
|
||||
pnid.scrub();
|
||||
|
||||
await pnid.save();
|
||||
|
||||
response.send('');
|
||||
});
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ export interface IPNIDMethods {
|
||||
updateMii(mii: { name: string, primary: string, data: string}): Promise<void>;
|
||||
generateMiiImages(): Promise<void>;
|
||||
getServerMode(): string;
|
||||
scrub(): void;
|
||||
}
|
||||
|
||||
interface IPNIDQueryHelpers {}
|
||||
|
||||
Reference in New Issue
Block a user