summaryrefslogtreecommitdiff
path: root/src/server/api/private
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-04-08 03:58:11 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-04-08 03:58:11 +0900
commita02ee3a08bac55c9f0b29cb6bc0a15726b7cc3c8 (patch)
treebf3c3dacd69737bf79eea0311fed1ddc504b15a5 /src/server/api/private
parentPost --> Note (diff)
downloadsharkey-a02ee3a08bac55c9f0b29cb6bc0a15726b7cc3c8.tar.gz
sharkey-a02ee3a08bac55c9f0b29cb6bc0a15726b7cc3c8.tar.bz2
sharkey-a02ee3a08bac55c9f0b29cb6bc0a15726b7cc3c8.zip
Some bug fixes
Diffstat (limited to 'src/server/api/private')
-rw-r--r--src/server/api/private/signin.ts10
-rw-r--r--src/server/api/private/signup.ts55
2 files changed, 24 insertions, 41 deletions
diff --git a/src/server/api/private/signin.ts b/src/server/api/private/signin.ts
index e0bd67d1ca..d7c4832c95 100644
--- a/src/server/api/private/signin.ts
+++ b/src/server/api/private/signin.ts
@@ -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
});
diff --git a/src/server/api/private/signup.ts b/src/server/api/private/signup.ts
index 5818ba25cd..f441e1b754 100644
--- a/src/server/api/private/signup.ts
+++ b/src/server/api/private/signup.ts
@@ -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
- }
- });
- }
};