aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/Main.tsx13
-rw-r--r--src/server/authentication/controllers/user.ts16
-rw-r--r--src/server/index.ts14
3 files changed, 27 insertions, 16 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index 858c02eb4..2a3e2780b 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -100,6 +100,19 @@ Documents.initProtos(() => {
ReactDOM.render((
<div style={{ position: "absolute", width: "100%", height: "100%" }}>
+ <a href="/logout">
+ <img
+ src="http://aux.iconspalace.com/uploads/logout-icon-256-510450847.png"
+ style={{
+ position: "absolute",
+ width: "20px",
+ height: "20px",
+ top: "20px",
+ zIndex: 15,
+ right: "20px",
+ }}
+ />
+ </a>
<DocumentView Document={mainContainer} ContainingCollectionView={undefined} DocumentView={undefined} />
<DocumentDecorations />
<ContextMenu />
diff --git a/src/server/authentication/controllers/user.ts b/src/server/authentication/controllers/user.ts
index 72fdd5137..554781409 100644
--- a/src/server/authentication/controllers/user.ts
+++ b/src/server/authentication/controllers/user.ts
@@ -5,7 +5,6 @@ import { IVerifyOptions } from "passport-local";
import "../config/passport";
import * as request from "express-validator";
const flash = require("express-flash");
-import * as path from 'path'
import * as session from "express-session";
import * as pug from 'pug';
@@ -18,17 +17,6 @@ export let getEntry = (req: Request, res: Response) => {
res.redirect("/login");
}
-export let getHome = (req: Request, res: Response) => {
- // if user is not logged in, redirect to log in page
- if (!req.user) {
- res.redirect("/login");
- return;
- }
- // otherwise, connect them to Dash
- // TODO: store and manage users' workspaces
- res.sendFile(path.join(__dirname, '../../deploy/index.html'));
-}
-
/**
* GET /signup
* Directs user to the signup page
@@ -38,7 +26,7 @@ export let getSignup = (req: Request, res: Response) => {
if (req.user) {
let user = req.user;
console.log(user);
- return res.redirect("/");
+ return res.redirect("/home");
}
res.render("signup.pug", {
title: "Sign Up"
@@ -104,7 +92,7 @@ export let postSignup = (req: Request, res: Response, next: NextFunction) => {
*/
export let getLogin = (req: Request, res: Response) => {
if (req.user) {
- return res.redirect("/");
+ return res.redirect("/home");
}
res.render("login.pug", {
title: "Log In"
diff --git a/src/server/index.ts b/src/server/index.ts
index d097b4aec..7189b32a0 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -16,7 +16,7 @@ import { ObjectID } from 'mongodb';
import { Document } from '../fields/Document';
import * as io from 'socket.io'
import * as passportConfig from './authentication/config/passport';
-import { getLogin, postLogin, getSignup, postSignup, getLogout, getEntry, getHome } from './authentication/controllers/user';
+import { getLogin, postLogin, getSignup, postSignup, getLogout, getEntry } from './authentication/controllers/user';
const config = require('../../webpack.config');
const compiler = webpack(config);
const port = 1050; // default port to listen
@@ -32,6 +32,7 @@ const MongoStore = require('connect-mongo')(session);
const mongoose = require('mongoose');
const bluebird = require('bluebird');
import { performance } from 'perf_hooks'
+import * as path from 'path'
const mongoUrl = 'mongodb://localhost:27017/Dash';
// mongoose.Promise = bluebird;
@@ -77,7 +78,16 @@ app.use((req, res, next) => {
// functions in the exports of user.ts
// /home defines destination after a successful log in
-app.get("/home", getHome);
+app.get("/home", (req, res) => {
+ // if user is not logged in, redirect to log in page
+ if (!req.user) {
+ res.redirect("/login");
+ return;
+ }
+ // otherwise, connect them to Dash
+ // TODO: store and manage users' workspaces
+ res.sendFile(path.join(__dirname, '../../deploy/index.html'));
+});
// anyone attempting to navigate to localhost at this port will
// first have to login