diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-11-23 13:25:33 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-11-23 13:25:33 +0900 |
| commit | 767a292dbdaedeb34de5476f0c23ca25a0395e90 (patch) | |
| tree | 91669b7a99930967d0ec1699dec35730cb5483c5 /src/api/private | |
| parent | Improve readability (diff) | |
| download | sharkey-767a292dbdaedeb34de5476f0c23ca25a0395e90.tar.gz sharkey-767a292dbdaedeb34de5476f0c23ca25a0395e90.tar.bz2 sharkey-767a292dbdaedeb34de5476f0c23ca25a0395e90.zip | |
#939
Diffstat (limited to 'src/api/private')
| -rw-r--r-- | src/api/private/signin.ts | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/api/private/signin.ts b/src/api/private/signin.ts index 0689887925..0ebf8d6aa1 100644 --- a/src/api/private/signin.ts +++ b/src/api/private/signin.ts @@ -4,7 +4,7 @@ import { default as User, IUser } from '../models/user'; import Signin from '../models/signin'; import serialize from '../serializers/signin'; import event from '../event'; -import config from '../../conf'; +import signin from '../common/signin'; export default async (req: express.Request, res: express.Response) => { res.header('Access-Control-Allow-Credentials', 'true'); @@ -43,17 +43,7 @@ export default async (req: express.Request, res: express.Response) => { const same = await bcrypt.compare(password, user.password); if (same) { - const expires = 1000 * 60 * 60 * 24 * 365; // One Year - res.cookie('i', user.token, { - path: '/', - domain: `.${config.host}`, - secure: config.url.substr(0, 5) === 'https', - httpOnly: false, - expires: new Date(Date.now() + expires), - maxAge: expires - }); - - res.sendStatus(204); + signin(res, user, false); } else { res.status(400).send({ error: 'incorrect password' |