diff options
author | bob <bcz@cs.brown.edu> | 2019-12-02 13:22:02 -0500 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-12-02 13:22:02 -0500 |
commit | 1ef06e189a352e5472ee267d44d4b3c96042f03c (patch) | |
tree | eefed629be388e83dc71a7b3c574326fc0343f06 /src/server/authentication/config/passport.ts | |
parent | 1280c005829cf49fd106fd872afcf4ed6593a2f6 (diff) | |
parent | 0595f93dde717b7b6990e9a81c5b43a73a3808d5 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/server/authentication/config/passport.ts')
-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..726df7fd7 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 as any).tokens!, { kind: provider })) { next(); } else { res.redirect(`/auth/${provider}`); |