mirror of
https://github.com/MisskeyIO/misskey
synced 2024-12-26 20:48:21 +09:00
2756f553c6
* wip
* wip
* wip
* Update attached_notes.ts
* wip
* Refactor
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update call.ts
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* ✌️
* Fix
54 lines
1.1 KiB
TypeScript
54 lines
1.1 KiB
TypeScript
import $ from 'cafy';
|
|
import * as bcrypt from 'bcryptjs';
|
|
import User from '../../../../models/user';
|
|
import define from '../../define';
|
|
import { createDeleteNotesJob, createDeleteDriveFilesJob } from '../../../../queue';
|
|
import Message from '../../../../models/messaging-message';
|
|
import Signin from '../../../../models/signin';
|
|
|
|
export const meta = {
|
|
requireCredential: true,
|
|
|
|
secure: true,
|
|
|
|
params: {
|
|
password: {
|
|
validator: $.str
|
|
},
|
|
}
|
|
};
|
|
|
|
export default define(meta, async (ps, user) => {
|
|
// Compare password
|
|
const same = await bcrypt.compare(ps.password, user.password);
|
|
|
|
if (!same) {
|
|
throw new Error('incorrect password');
|
|
}
|
|
|
|
await User.update({ _id: user._id }, {
|
|
$set: {
|
|
isDeleted: true,
|
|
token: null,
|
|
name: null,
|
|
description: null,
|
|
pinnedNoteIds: [],
|
|
password: null,
|
|
email: null,
|
|
twitter: null,
|
|
github: null,
|
|
discord: null,
|
|
profile: {},
|
|
fields: [],
|
|
clientSettings: {},
|
|
}
|
|
});
|
|
|
|
Message.remove({ userId: user._id });
|
|
Signin.remove({ userId: user._id });
|
|
createDeleteNotesJob(user);
|
|
createDeleteDriveFilesJob(user);
|
|
|
|
return;
|
|
});
|