diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-01-06 11:07:42 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-01-06 11:07:42 +0900 |
| commit | 86548f6468217f45d0b59a04e6283492a1eef0bf (patch) | |
| tree | 64c76889cc1a9aeb9931b79270072def265a23c0 /src/api/authenticate.ts | |
| parent | Mobile: Fix design glitch :art: (diff) | |
| download | sharkey-86548f6468217f45d0b59a04e6283492a1eef0bf.tar.gz sharkey-86548f6468217f45d0b59a04e6283492a1eef0bf.tar.bz2 sharkey-86548f6468217f45d0b59a04e6283492a1eef0bf.zip | |
Refactor: Extract isNativeToken method
Diffstat (limited to 'src/api/authenticate.ts')
| -rw-r--r-- | src/api/authenticate.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/api/authenticate.ts b/src/api/authenticate.ts index 16a7ee1b45..832517379f 100644 --- a/src/api/authenticate.ts +++ b/src/api/authenticate.ts @@ -2,6 +2,7 @@ import * as express from 'express'; import App from './models/app'; import User from './models/user'; import Userkey from './models/userkey'; +import isNativeToken from './common/is-native-token'; export interface IAuthContext { /** @@ -27,7 +28,7 @@ export default (req: express.Request) => new Promise<IAuthContext>(async (resolv return resolve({ app: null, user: null, isSecure: false }); } - if (token[0] == '!') { + if (isNativeToken(token)) { const user = await User .findOne({ token: token }); |