aboutsummaryrefslogtreecommitdiff
path: root/src/server/authentication/config
diff options
context:
space:
mode:
authorSam Wilkins <35748010+samwilkins333@users.noreply.github.com>2019-12-02 12:21:09 -0500
committerGitHub <noreply@github.com>2019-12-02 12:21:09 -0500
commit0595f93dde717b7b6990e9a81c5b43a73a3808d5 (patch)
treeaf03ac257a5584f9913f120c44d4d39bb13916f2 /src/server/authentication/config
parent68f49ef5daf3bf5c47d1d21c8f1cd2097947d071 (diff)
parentae76fd39a6530ac055948bb7b98537d38b592ef6 (diff)
Merge pull request #316 from browngraphicslab/server_refactor
Server refactor
Diffstat (limited to 'src/server/authentication/config')
-rw-r--r--src/server/authentication/config/passport.ts5
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}`);