テーブル分割
This commit is contained in:
parent
9603f3fa4f
commit
626cfb61ac
33 changed files with 267 additions and 232 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import $ from 'cafy';
|
||||
import * as bcrypt from 'bcryptjs';
|
||||
import define from '../../define';
|
||||
import { Users } from '../../../../models';
|
||||
import { Users, UserProfiles } from '../../../../models';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: true,
|
||||
|
|
@ -16,8 +16,10 @@ export const meta = {
|
|||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
const profile = await UserProfiles.findOne({ userId: user.id });
|
||||
|
||||
// Compare password
|
||||
const same = await bcrypt.compare(ps.password, user.password);
|
||||
const same = await bcrypt.compare(ps.password, profile.password);
|
||||
|
||||
if (!same) {
|
||||
throw new Error('incorrect password');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue