diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-04-10 15:04:27 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-04-10 15:04:27 +0900 |
| commit | 626cfb61ac3940bee7a3acf1b1c5c4cae4ae410c (patch) | |
| tree | 23b89c000b1b169c36cffc7a345a2fc1ebe33347 /src/server/api/private | |
| parent | Delete get-user-summary.ts (diff) | |
| download | misskey-626cfb61ac3940bee7a3acf1b1c5c4cae4ae410c.tar.gz misskey-626cfb61ac3940bee7a3acf1b1c5c4cae4ae410c.tar.bz2 misskey-626cfb61ac3940bee7a3acf1b1c5c4cae4ae410c.zip | |
テーブル分割
Diffstat (limited to 'src/server/api/private')
| -rw-r--r-- | src/server/api/private/signin.ts | 10 | ||||
| -rw-r--r-- | src/server/api/private/signup.ts | 18 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/server/api/private/signin.ts b/src/server/api/private/signin.ts index c1fd908d8a..fe2e5577c2 100644 --- a/src/server/api/private/signin.ts +++ b/src/server/api/private/signin.ts @@ -4,7 +4,7 @@ import * as speakeasy from 'speakeasy'; import { publishMainStream } from '../../../services/stream'; import signin from '../common/signin'; import config from '../../../config'; -import { Users, Signins } from '../../../models'; +import { Users, Signins, UserProfiles } from '../../../models'; import { ILocalUser } from '../../../models/entities/user'; import { genId } from '../../../misc/gen-id'; @@ -45,13 +45,15 @@ export default async (ctx: Koa.BaseContext) => { return; } + const profile = await UserProfiles.findOne({ userId: user.id }); + // Compare password - const same = await bcrypt.compare(password, user.password); + const same = await bcrypt.compare(password, profile.password); if (same) { - if (user.twoFactorEnabled) { + if (profile.twoFactorEnabled) { const verified = (speakeasy as any).totp.verify({ - secret: user.twoFactorSecret, + secret: profile.twoFactorSecret, encoding: 'base32', token: token }); diff --git a/src/server/api/private/signup.ts b/src/server/api/private/signup.ts index 657e54decd..5ed25fa411 100644 --- a/src/server/api/private/signup.ts +++ b/src/server/api/private/signup.ts @@ -5,13 +5,13 @@ import generateUserToken from '../common/generate-native-user-token'; import config from '../../../config'; import fetchMeta from '../../../misc/fetch-meta'; import * as recaptcha from 'recaptcha-promise'; -import { Users, RegistrationTickets, UserServiceLinkings, UserKeypairs } from '../../../models'; +import { Users, RegistrationTickets, UserProfiles, UserKeypairs } from '../../../models'; import { genId } from '../../../misc/gen-id'; import { usersChart } from '../../../services/chart'; -import { UserServiceLinking } from '../../../models/entities/user-service-linking'; import { User } from '../../../models/entities/user'; import { UserKeypair } from '../../../models/entities/user-keypair'; import { toPuny } from '../../../misc/convert-host'; +import { UserProfile } from '../../../models/entities/user-profile'; export default async (ctx: Koa.BaseContext) => { const body = ctx.request.body as any; @@ -106,23 +106,21 @@ export default async (ctx: Koa.BaseContext) => { usernameLower: username.toLowerCase(), host: toPuny(host), token: secret, - password: hash, isAdmin: config.autoAdmin && usersCount === 0, - autoAcceptFollowed: true, - autoWatch: false } as User); await UserKeypairs.save({ - id: genId(), publicKey: keyPair[0], privateKey: keyPair[1], userId: account.id } as UserKeypair); - await UserServiceLinkings.save({ - id: genId(), - userId: account.id - } as UserServiceLinking); + await UserProfiles.save({ + userId: account.id, + autoAcceptFollowed: true, + autoWatch: false, + password: hash, + } as Partial<UserProfile>); usersChart.update(account, true); |