-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
My profile - edit my details form view - WIP #62
Closed
Closed
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
03f5740
Add middleware to protected routes and create my profile details edit…
helenzhou6 b5bb567
Add html content to my profile - my details - edit form
helenzhou6 d64e92a
Add ensureAuthentication middleware and restructured the controllers …
helenzhou6 80b364f
Resolve merge conflict
helenzhou6 7cb0b3d
Resolve merge conflict
helenzhou6 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,25 @@ const router = require('express').Router(); | |
const passport = require('passport'); | ||
|
||
const home = require('./home'); | ||
const profileDetails = require('./profileDetails'); | ||
// const auth = require('./auth'); | ||
|
||
router.get('/', home.get); | ||
|
||
// MIDDLEWARE to ensure used is authenticated | ||
function ensureAuthenticated(req, res, next) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should es6 here |
||
if (req.isAuthenticated()) { | ||
// req.user is available for use here | ||
return next(); | ||
} | ||
// denied - should redirect to login | ||
res.redirect('/'); | ||
} | ||
|
||
// auth routes | ||
router.get( | ||
'/auth/github/signup', | ||
passport.authenticate('github', { scope: ['read:org'] }), | ||
passport.authenticate('github', { scope: ['read:org'] }) | ||
); | ||
|
||
router.get( | ||
|
@@ -30,6 +41,12 @@ router.get('/auth/github/logout', (req, res) => { | |
req.logout(); | ||
res.redirect('/'); | ||
}); | ||
|
||
router.get( | ||
'/myprofile/mydetails/edit', ensureAuthenticated, profileDetails.get | ||
); | ||
|
||
|
||
// router.get('/auth/github/signup', auth.signup); | ||
// router.get('/auth/github/callback', auth.signupCallback); | ||
// router.get('/auth/github/logout', auth.logout); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
exports.get = (req, res) => { | ||
res.render('profileDetails', { activePage: { profile: true }, loggedIn: true }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<h1>My Details</h1> | ||
<form novalidate> | ||
<span>* Required</span> | ||
<label for="full_name">Full Name * | ||
<input id="full_name" type="text" /> | ||
</label> | ||
<label for="github_handle">GitHub/Gitter Username * | ||
<input id="github_handle" type="text" /> | ||
</label> | ||
<label for="fac_campus">FAC Location * | ||
<select id="fac_campus"> | ||
<option value="London">London</option> | ||
<option value="Nazareth">Nazareth</option> | ||
<option value="Gaza">Gaza</option> | ||
</select> | ||
</label> | ||
<label for="fac_number">FAC Cohort Number * | ||
<input id="fac_number" type="number" /> | ||
</label> | ||
<label for="tech_stack">Tech Stack | ||
<select id="tech_stack"> | ||
<option value="JavaScript">JavaScript</option> | ||
<option value="HTML">HTML</option> | ||
<option value="CSS3">CSS3</option> | ||
</select> | ||
</label> | ||
<label for="linkedin_url">LinkedIn URL | ||
<input id="linkedin_url" type="text" /> | ||
</label> | ||
<label for="twitter_handle">Twitter Handle | ||
<input id="twitter_handle" type="text" /> | ||
</label> | ||
<button>Submit</button> | ||
</form> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we start collecting middleware, we should modularise them.