aboutsummaryrefslogtreecommitdiff
path: root/src/server/authentication/controllers
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-02-24 23:45:43 -0500
committerSam Wilkins <samwilkins333@gmail.com>2019-02-24 23:45:43 -0500
commita160304a54ee0219f48faee8a7402503f2160902 (patch)
treed41e7cc0ad7fb621d0a2d891eeda77766dc84021 /src/server/authentication/controllers
parent7e106c6aa0bab72ae757453f88dd7616b4be0c5c (diff)
lost password email implementation beginning
Diffstat (limited to 'src/server/authentication/controllers')
-rw-r--r--src/server/authentication/controllers/user.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/server/authentication/controllers/user.ts b/src/server/authentication/controllers/user.ts
index 93986adf8..a496959d1 100644
--- a/src/server/authentication/controllers/user.ts
+++ b/src/server/authentication/controllers/user.ts
@@ -12,6 +12,8 @@ import * as pug from 'pug';
* GET /
* Whenever a user navigates to the root of Dash
* (doesn't specify a sub-route), redirect to login.
+ * If the user is already signed in, it will effectively
+ * automatically redirect them to /home instead
*/
export let getEntry = (req: Request, res: Response) => {
res.redirect("/login");
@@ -29,6 +31,7 @@ export let getSignup = (req: Request, res: Response) => {
}
res.render("signup.pug", {
title: "Sign Up",
+ user: req.user,
errors: req.flash("Unable to facilitate sign up. Please try again.")
});
};
@@ -61,7 +64,9 @@ export let postSignup = (req: Request, res: Response, next: NextFunction) => {
const user = new User({
email,
password,
+ userDoc: "document here"
});
+
User.findOne({ email }, (err, existingUser) => {
if (err) { return next(err); }
if (existingUser) {
@@ -94,7 +99,8 @@ export let getLogin = (req: Request, res: Response) => {
return res.redirect("/home");
}
res.render("login.pug", {
- title: "Log In"
+ title: "Log In",
+ user: req.user
});
};