Some bug fixes

This commit is contained in:
syuilo
2018-04-08 03:58:11 +09:00
parent a1b490afa7
commit a02ee3a08b
81 changed files with 337 additions and 1318 deletions

View File

@ -37,7 +37,7 @@ export default async (req: express.Request, res: express.Response) => {
}, {
fields: {
data: false,
'account.profile': false
'profile': false
}
}) as ILocalUser;
@ -48,15 +48,13 @@ export default async (req: express.Request, res: express.Response) => {
return;
}
const account = user.account;
// Compare password
const same = await bcrypt.compare(password, account.password);
const same = await bcrypt.compare(password, password);
if (same) {
if (account.twoFactorEnabled) {
if (user.twoFactorEnabled) {
const verified = (speakeasy as any).totp.verify({
secret: account.twoFactorSecret,
secret: user.twoFactorSecret,
encoding: 'base32',
token: token
});

View File

@ -119,44 +119,29 @@ export default async (req: express.Request, res: express.Response) => {
usernameLower: username.toLowerCase(),
host: null,
hostLower: null,
account: {
keypair: generateKeypair(),
token: secret,
email: null,
links: null,
password: hash,
profile: {
bio: null,
birthday: null,
blood: null,
gender: null,
handedness: null,
height: null,
location: null,
weight: null
},
settings: {
autoWatch: true
},
clientSettings: {
home: homeData
}
keypair: generateKeypair(),
token: secret,
email: null,
links: null,
password: hash,
profile: {
bio: null,
birthday: null,
blood: null,
gender: null,
handedness: null,
height: null,
location: null,
weight: null
},
settings: {
autoWatch: true
},
clientSettings: {
home: homeData
}
});
// Response
res.send(await pack(account));
// Create search index
if (config.elasticsearch.enable) {
const es = require('../../db/elasticsearch');
es.index({
index: 'misskey',
type: 'user',
id: account._id.toString(),
body: {
username: username
}
});
}
};