From a02ee3a08bac55c9f0b29cb6bc0a15726b7cc3c8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 8 Apr 2018 03:58:11 +0900 Subject: Some bug fixes --- src/server/api/endpoints/i/2fa/done.ts | 4 ++-- src/server/api/endpoints/i/2fa/register.ts | 2 +- src/server/api/endpoints/i/2fa/unregister.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/server/api/endpoints/i/2fa') diff --git a/src/server/api/endpoints/i/2fa/done.ts b/src/server/api/endpoints/i/2fa/done.ts index 0b2e32c13f..3e824feffd 100644 --- a/src/server/api/endpoints/i/2fa/done.ts +++ b/src/server/api/endpoints/i/2fa/done.ts @@ -28,8 +28,8 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { await User.update(user._id, { $set: { - 'account.twoFactorSecret': user.twoFactorTempSecret, - 'account.twoFactorEnabled': true + 'twoFactorSecret': user.twoFactorTempSecret, + 'twoFactorEnabled': true } }); diff --git a/src/server/api/endpoints/i/2fa/register.ts b/src/server/api/endpoints/i/2fa/register.ts index dc7fb959bb..bed64a2545 100644 --- a/src/server/api/endpoints/i/2fa/register.ts +++ b/src/server/api/endpoints/i/2fa/register.ts @@ -14,7 +14,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { if (passwordErr) return rej('invalid password param'); // Compare password - const same = await bcrypt.compare(password, user.account.password); + const same = await bcrypt.compare(password, user.password); if (!same) { return rej('incorrect password'); diff --git a/src/server/api/endpoints/i/2fa/unregister.ts b/src/server/api/endpoints/i/2fa/unregister.ts index ff2a435fee..f9d7a25f53 100644 --- a/src/server/api/endpoints/i/2fa/unregister.ts +++ b/src/server/api/endpoints/i/2fa/unregister.ts @@ -11,7 +11,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { if (passwordErr) return rej('invalid password param'); // Compare password - const same = await bcrypt.compare(password, user.account.password); + const same = await bcrypt.compare(password, user.password); if (!same) { return rej('incorrect password'); @@ -19,8 +19,8 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { await User.update(user._id, { $set: { - 'account.twoFactorSecret': null, - 'account.twoFactorEnabled': false + 'twoFactorSecret': null, + 'twoFactorEnabled': false } }); -- cgit v1.2.3-freya