diff options
| author | Eleanor Eng <eleanor.eng5@gmail.com> | 2019-11-16 16:37:36 -0500 |
|---|---|---|
| committer | Eleanor Eng <eleanor.eng5@gmail.com> | 2019-11-16 16:37:36 -0500 |
| commit | b5111d4f4c44b845b7dd324e4332bcdc12eda0b8 (patch) | |
| tree | 3c8ecc0af2accd5a49d6ff3ba1e46e7dab82858d /src/server/authentication/config | |
| parent | c24c16efbf798eac1003811f6c0ed98bfc65f48e (diff) | |
| parent | ab285371f6fb2a4f1e64888bafbc84b602f23416 (diff) | |
merge
Diffstat (limited to 'src/server/authentication/config')
| -rw-r--r-- | src/server/authentication/config/passport.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/server/authentication/config/passport.ts b/src/server/authentication/config/passport.ts index 8915a4abf..0b15c3a36 100644 --- a/src/server/authentication/config/passport.ts +++ b/src/server/authentication/config/passport.ts @@ -3,7 +3,6 @@ import * as passportLocal from 'passport-local'; import _ from "lodash"; import { default as User } from '../models/user_model'; import { Request, Response, NextFunction } from "express"; -import { RouteStore } from '../../RouteStore'; const LocalStrategy = passportLocal.Strategy; @@ -35,13 +34,13 @@ export let isAuthenticated = (req: Request, res: Response, next: NextFunction) = if (req.isAuthenticated()) { return next(); } - return res.redirect(RouteStore.login); + return res.redirect("/login"); }; export let isAuthorized = (req: Request, res: Response, next: NextFunction) => { const provider = req.path.split("/").slice(-1)[0]; - if (_.find((req.user as any).tokens, { kind: provider })) { + if (_.find((req.user).tokens, { kind: provider })) { next(); } else { res.redirect(`/auth/${provider}`); |
