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
});