diff options
| author | kimdahey <claire_kim1@brown.edu> | 2019-08-29 14:32:53 -0400 |
|---|---|---|
| committer | kimdahey <claire_kim1@brown.edu> | 2019-08-29 14:32:53 -0400 |
| commit | 8e2e2c1126086cbc87432bb0466205f892d8ae98 (patch) | |
| tree | d28a6721bcc392906a0ebd091c4acd11ff4747c0 /src/server/authentication/config | |
| parent | 116c17c1e4ccf189d770d170d07a6bfbf95ca4e1 (diff) | |
| parent | 22a5999626b11cf75cafbcd421601e668438f6ad (diff) | |
fix merge conflicts
Diffstat (limited to 'src/server/authentication/config')
| -rw-r--r-- | src/server/authentication/config/passport.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/server/authentication/config/passport.ts b/src/server/authentication/config/passport.ts index d42741410..10b17de71 100644 --- a/src/server/authentication/config/passport.ts +++ b/src/server/authentication/config/passport.ts @@ -42,9 +42,11 @@ export let isAuthenticated = (req: Request, res: Response, next: NextFunction) = export let isAuthorized = (req: Request, res: Response, next: NextFunction) => { const provider = req.path.split("/").slice(-1)[0]; - if (_.find(req.user.tokens, { kind: provider })) { - next(); - } else { - res.redirect(`/auth/${provider}`); + if (req.user) { + if (_.find((req.user as any).tokens, { kind: provider })) { + next(); + } else { + res.redirect(`/auth/${provider}`); + } } };
\ No newline at end of file |
