Resolve #1669
This commit is contained in:
@ -35,7 +35,7 @@ export default define(meta, async (ps, user) => {
|
||||
throw new Error('not verified');
|
||||
}
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
twoFactorSecret: profile.twoFactorTempSecret,
|
||||
twoFactorEnabled: true
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ export default define(meta, async (ps, user) => {
|
||||
length: 32
|
||||
});
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
twoFactorTempSecret: secret.base32
|
||||
});
|
||||
|
||||
|
@ -26,7 +26,7 @@ export default define(meta, async (ps, user) => {
|
||||
throw new Error('incorrect password');
|
||||
}
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
twoFactorSecret: null,
|
||||
twoFactorEnabled: false
|
||||
});
|
||||
|
@ -34,7 +34,7 @@ export default define(meta, async (ps, user) => {
|
||||
const salt = await bcrypt.genSalt(8);
|
||||
const hash = await bcrypt.hash(ps.newPassword, salt);
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
password: hash
|
||||
});
|
||||
});
|
||||
|
@ -49,7 +49,7 @@ export default define(meta, async (ps, user) => {
|
||||
throw new ApiError(meta.errors.incorrectPassword);
|
||||
}
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
email: ps.email,
|
||||
emailVerified: false,
|
||||
emailVerifyCode: null
|
||||
@ -66,7 +66,7 @@ export default define(meta, async (ps, user) => {
|
||||
if (ps.email != null) {
|
||||
const code = rndstr('a-z0-9', 16);
|
||||
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
emailVerifyCode: code
|
||||
});
|
||||
|
||||
|
@ -268,7 +268,7 @@ export default define(meta, async (ps, user, app) => {
|
||||
//#endregion
|
||||
|
||||
if (Object.keys(updates).length > 0) await Users.update(user.id, updates);
|
||||
if (Object.keys(profileUpdates).length > 0) await UserProfiles.update({ userId: user.id }, profileUpdates);
|
||||
if (Object.keys(profileUpdates).length > 0) await UserProfiles.update(user.id, profileUpdates);
|
||||
|
||||
const iObj = await Users.pack(user.id, user, {
|
||||
detail: true,
|
||||
|
@ -54,7 +54,7 @@ export default define(meta, async (ps, me) => {
|
||||
const profile = await UserProfiles.findOne(user.id).then(ensure);
|
||||
|
||||
if (profile.room.furnitures == null) {
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
room: {
|
||||
furnitures: [],
|
||||
...profile.room
|
||||
@ -66,7 +66,7 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
if (profile.room.roomType == null) {
|
||||
const initialType = 'default';
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
room: {
|
||||
roomType: initialType as any,
|
||||
...profile.room
|
||||
@ -78,7 +78,7 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
if (profile.room.carpetColor == null) {
|
||||
const initialColor = '#85CAF0';
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
room: {
|
||||
carpetColor: initialColor as any,
|
||||
...profile.room
|
||||
|
@ -32,7 +32,7 @@ export const meta = {
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
await UserProfiles.update({ userId: user.id }, {
|
||||
await UserProfiles.update(user.id, {
|
||||
room: ps.room as any
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user