aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-02-25 01:22:44 -0500
committerSam Wilkins <samwilkins333@gmail.com>2019-02-25 01:22:44 -0500
commit8658ecd710e83f863b5d762b05f9213eca9ecf7a (patch)
tree0687367eb245245816573a0f961b1dbbfbeba8ca /src/server
parent6ee6c97b039d373c8580b8a5c90148799fbfd97a (diff)
parent62e06a2c9ce5054777a7a790e5b03b96d3cd6425 (diff)
Merge branch 'authentication' of https://github.com/browngraphicslab/Dash-Web into authentication
Diffstat (limited to 'src/server')
-rw-r--r--src/server/authentication/models/User.ts3
-rw-r--r--src/server/index.ts15
2 files changed, 17 insertions, 1 deletions
diff --git a/src/server/authentication/models/User.ts b/src/server/authentication/models/User.ts
index 9e6c525c3..30fcecd81 100644
--- a/src/server/authentication/models/User.ts
+++ b/src/server/authentication/models/User.ts
@@ -45,7 +45,8 @@ const userSchema = new mongoose.Schema({
password: String,
passwordResetToken: String,
passwordResetExpires: Date,
- userDoc: String,
+
+ userDocumentId: String,
facebook: String,
twitter: String,
diff --git a/src/server/index.ts b/src/server/index.ts
index 9480eaacb..e99e5f98a 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -87,6 +87,21 @@ app.get("/home", (req, res) => {
res.sendFile(path.join(__dirname, '../../deploy/index.html'));
});
+app.get("/getUserDocId", (req, res) => {
+ console.log(req.user)
+ if (!req.user) {
+ return;
+ }
+ res.send(req.user.userDocumentId || "");
+})
+
+app.post("/setUserDocId", (req, res) => {
+ if (!req.user) {
+ return;
+ }
+ req.user.update({ $set: { userDocumentId: req.body.userDocumentId } }, () => { });
+})
+
// anyone attempting to navigate to localhost at this port will
// first have to login
app.get("/", getEntry);