Fixed 267U.pre2

This commit is contained in:
2026-07-26 18:25:37 +09:00
parent 50bfaeafdf
commit 317d00a284
1286 changed files with 80222 additions and 1 deletions
@@ -0,0 +1,39 @@
import { publishMainStream } from "../../../../../services/stream.js";
import define from "../../../define.js";
import { Users, UserProfiles } from "../../../../../models/index.js";
import { comparePassword } from "../../../../../misc/password.js";
export const meta = {
requireCredential: true,
secure: true
};
export const paramDef = {
type: "object",
properties: {
password: {
type: "string"
}
},
required: [
"password"
]
};
export default define(meta, paramDef, async (ps, user)=>{
const profile = await UserProfiles.findOneByOrFail({
userId: user.id
});
// Compare password
const same = await comparePassword(ps.password, profile.password);
if (!same) {
throw new Error("incorrect password");
}
await UserProfiles.update(user.id, {
twoFactorSecret: null,
twoFactorEnabled: false,
usePasswordLessLogin: false
});
const iObj = await Users.pack(user.id, user, {
detail: true,
includeSecrets: true
});
publishMainStream(user.id, "meUpdated", iObj);
});