aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-09-03 19:21:36 -0400
committerSam Wilkins <samwilkins333@gmail.com>2019-09-03 19:21:36 -0400
commit20e098859b13f37b0baf232682b032b98b85b6ea (patch)
tree993473fda6a44435bedf56e52cf0dda761605f25 /src/server
parent0c02b2ff3a41697c43d0aed98f330bd0293ef761 (diff)
parent25e8cc61f67bed3063dc81997d31f29e451b5610 (diff)
Merge branch 'googlephotos' of https://github.com/browngraphicslab/Dash-Web into googlephotos
Diffstat (limited to 'src/server')
-rw-r--r--src/server/authentication/config/passport.ts10
-rw-r--r--src/server/authentication/models/current_user_utils.ts3
-rw-r--r--src/server/index.ts6
3 files changed, 12 insertions, 7 deletions
diff --git a/src/server/authentication/config/passport.ts b/src/server/authentication/config/passport.ts
index e5733cbb5..8b20d29b1 100644
--- a/src/server/authentication/config/passport.ts
+++ b/src/server/authentication/config/passport.ts
@@ -41,9 +41,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
diff --git a/src/server/authentication/models/current_user_utils.ts b/src/server/authentication/models/current_user_utils.ts
index 83e45d3ce..9866e22eb 100644
--- a/src/server/authentication/models/current_user_utils.ts
+++ b/src/server/authentication/models/current_user_utils.ts
@@ -79,6 +79,9 @@ export class CurrentUserUtils {
Doc.GetProto(overlays).backgroundColor = "#aca3a6";
doc.overlays = overlays;
}
+ if (doc.linkFollowBox === undefined) {
+ PromiseValue(Cast(doc.overlays, Doc)).then(overlays => overlays && Doc.AddDocToList(overlays, "data", doc.linkFollowBox = Docs.Create.LinkFollowBoxDocument({ x: 250, y: 20, width: 500, height: 370, title: "Link Follower" })));
+ }
StrCast(doc.title).indexOf("@") !== -1 && (doc.title = StrCast(doc.title).split("@")[0] + "'s Library");
doc.width = 100;
doc.preventTreeViewOpen = true;
diff --git a/src/server/index.ts b/src/server/index.ts
index 3e85b1ce0..3940bbd58 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -114,7 +114,7 @@ function addSecureRoute(method: Method,
) {
let abstracted = (req: express.Request, res: express.Response) => {
if (req.user) {
- handler(req.user, res, req);
+ handler(req.user as any, res, req);
} else {
req.session!.target = req.originalUrl;
onRejection(res, req);
@@ -809,8 +809,8 @@ const EndpointHandlerMap = new Map<GoogleApiServerUtils.Action, GoogleApiServerU
]);
app.post(RouteStore.googleDocs + "/:sector/:action", (req, res) => {
- let sector = req.params.sector;
- let action = req.params.action;
+ let sector: any = req.params.sector;
+ let action: any = req.params.action;
GoogleApiServerUtils.GetEndpoint(GoogleApiServerUtils.Service[sector], { credentials, token }).then(endpoint => {
let handler = EndpointHandlerMap.get(action);
if (endpoint && handler) {