start refactoring account view into show view
This commit is contained in:
@ -68,7 +68,6 @@ module.exports = function(app) {
|
|||||||
router.post('/reset-password', postReset);
|
router.post('/reset-password', postReset);
|
||||||
router.get('/email-signup', getEmailSignup);
|
router.get('/email-signup', getEmailSignup);
|
||||||
router.get('/email-signin', getEmailSignin);
|
router.get('/email-signin', getEmailSignin);
|
||||||
router.get('/account/api', getAccountAngular);
|
|
||||||
router.post(
|
router.post(
|
||||||
'/account/delete',
|
'/account/delete',
|
||||||
ifNoUser401,
|
ifNoUser401,
|
||||||
@ -114,18 +113,7 @@ module.exports = function(app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAccount(req, res) {
|
function getAccount(req, res) {
|
||||||
if (!req.user) {
|
return res.redirect('/' + user.username);
|
||||||
return res.redirect('/');
|
|
||||||
}
|
|
||||||
res.render('account/account', {
|
|
||||||
title: 'Manage your Free Code Camp Account'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getAccountAngular(req, res) {
|
|
||||||
res.json({
|
|
||||||
user: req.user || {}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function returnUser(req, res, next) {
|
function returnUser(req, res, next) {
|
||||||
@ -143,14 +131,6 @@ module.exports = function(app) {
|
|||||||
});
|
});
|
||||||
return res.redirect('/');
|
return res.redirect('/');
|
||||||
}
|
}
|
||||||
if (!user.isGithubCool && !user.isMigrationGrandfathered) {
|
|
||||||
req.flash('errors', {
|
|
||||||
msg: `
|
|
||||||
user ${ username } has not completed account signup
|
|
||||||
`
|
|
||||||
});
|
|
||||||
return res.redirect('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
var cals = user
|
var cals = user
|
||||||
.progressTimestamps
|
.progressTimestamps
|
||||||
|
@ -2,74 +2,4 @@ extends ../layout
|
|||||||
block content
|
block content
|
||||||
script.
|
script.
|
||||||
var challengeName = 'Account View'
|
var challengeName = 'Account View'
|
||||||
.panel.panel-info
|
|
||||||
.panel-heading.text-center Manage your account here
|
|
||||||
.panel-body
|
|
||||||
.row
|
|
||||||
.col-xs-12
|
|
||||||
if (!user.isGithubCool)
|
|
||||||
a.btn.btn-lg.btn-block.btn-github.btn-link-social(href='/link/github')
|
|
||||||
i.fa.fa-github
|
|
||||||
| Link my GitHub to unlock this profile
|
|
||||||
else
|
|
||||||
a.btn.btn-lg.btn-block.btn-github.btn-link-social(href='/link/github')
|
|
||||||
i.fa.fa-github
|
|
||||||
| Update my profile from GitHub
|
|
||||||
|
|
||||||
if (!user.twitter)
|
|
||||||
.col-xs-12
|
|
||||||
a.btn.btn-lg.btn-block.btn-twitter.btn-link-social(href='/link/twitter')
|
|
||||||
i.fa.fa-twitter
|
|
||||||
| Add my Twitter to my profile
|
|
||||||
if (!user.facebook)
|
|
||||||
.col-xs-12
|
|
||||||
a.btn.btn-lg.btn-block.btn-facebook.btn-link-social(href='/link/facebook')
|
|
||||||
i.fa.fa-facebook
|
|
||||||
| Add my Facebook to my profile
|
|
||||||
if (!user.linkedin)
|
|
||||||
.col-xs-12
|
|
||||||
a.btn.btn-lg.btn-block.btn-linkedin.btn-link-social(href='/link/linkedin')
|
|
||||||
i.fa.fa-linkedin
|
|
||||||
| Add my LinkedIn to my profile
|
|
||||||
if (!user.google)
|
|
||||||
.col-xs-12
|
|
||||||
a.btn.btn-lg.btn-block.btn-google-plus.btn-link-social(href='/link/google')
|
|
||||||
i.fa.fa-google-plus
|
|
||||||
| Add my Google+ to my profile
|
|
||||||
.big-spacer
|
|
||||||
.col-xs-12
|
|
||||||
a.btn.btn-lg.btn-block.btn-warning.btn-link-social(href='/logout')
|
|
||||||
span.ion-android-exit
|
|
||||||
| Sign me out of Free Code Camp
|
|
||||||
.col-xs-12
|
|
||||||
a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='mailto:team@freecodecamp.com')
|
|
||||||
span.ion-email
|
|
||||||
| Email us at team@freecodecamp.com
|
|
||||||
.col-xs-12
|
|
||||||
a.btn.btn-lg.btn-block.btn-danger.btn-link-social.confirm-deletion
|
|
||||||
span.ion-trash-b
|
|
||||||
| Delete my Free Code Camp account
|
|
||||||
script.
|
|
||||||
$('.confirm-deletion').on("click", function() {
|
|
||||||
$('#modal-dialog').modal('show');
|
|
||||||
});
|
|
||||||
#modal-dialog.modal.animated.wobble
|
|
||||||
.modal-dialog
|
|
||||||
.modal-content
|
|
||||||
.modal-header
|
|
||||||
a.close(href='#', data-dismiss='modal', aria-hidden='true') ×
|
|
||||||
h3 Are you really leaving us?
|
|
||||||
.modal-body
|
|
||||||
p Pro Tip: If you tweet feedback to 
|
|
||||||
a(href="https://twitter.com/intent/tweet?text=Hey%20@freecodecamp") @FreeCodeCamp
|
|
||||||
| , we'll act quickly on it!
|
|
||||||
.modal-footer
|
|
||||||
a.btn.btn-success.btn-block(href='#', data-dismiss='modal', aria-hidden='true')
|
|
||||||
span.ion-happy
|
|
||||||
| Nevermind, I'll stick around
|
|
||||||
br
|
|
||||||
form(action='/account/delete', method='POST')
|
|
||||||
input(type='hidden', name='_csrf', value=_csrf)
|
|
||||||
button.btn.btn-danger.btn-block(type='submit')
|
|
||||||
span.ion-trash-b
|
|
||||||
| Yes, delete my account
|
|
||||||
|
@ -3,11 +3,83 @@ block content
|
|||||||
script(src="/bower_components/cal-heatmap/cal-heatmap.min.js")
|
script(src="/bower_components/cal-heatmap/cal-heatmap.min.js")
|
||||||
script.
|
script.
|
||||||
var challengeName = 'Profile View';
|
var challengeName = 'Profile View';
|
||||||
|
if (user && user.username === username)
|
||||||
|
.panel.panel-info
|
||||||
|
.panel-heading.text-center Manage your account
|
||||||
|
.panel-body
|
||||||
|
.row
|
||||||
|
.col-xs-12
|
||||||
|
if (!user.isGithubCool)
|
||||||
|
a.btn.btn-lg.btn-block.btn-github.btn-link-social(href='/link/github')
|
||||||
|
i.fa.fa-github
|
||||||
|
| Link my GitHub to unlock this profile
|
||||||
|
else
|
||||||
|
a.btn.btn-lg.btn-block.btn-github.btn-link-social(href='/link/github')
|
||||||
|
i.fa.fa-github
|
||||||
|
| Update my profile from GitHub
|
||||||
|
if (!user.twitter)
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-twitter.btn-link-social(href='/link/twitter')
|
||||||
|
i.fa.fa-twitter
|
||||||
|
| Add my Twitter to my profile
|
||||||
|
if (!user.facebook)
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-facebook.btn-link-social(href='/link/facebook')
|
||||||
|
i.fa.fa-facebook
|
||||||
|
| Add my Facebook to my profile
|
||||||
|
if (!user.linkedin)
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-linkedin.btn-link-social(href='/link/linkedin')
|
||||||
|
i.fa.fa-linkedin
|
||||||
|
| Add my LinkedIn to my profile
|
||||||
|
if (!user.google)
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-google-plus.btn-link-social(href='/link/google')
|
||||||
|
i.fa.fa-google-plus
|
||||||
|
| Add my Google+ to my profile
|
||||||
|
.big-spacer
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-warning.btn-link-social(href='/logout')
|
||||||
|
span.ion-android-exit
|
||||||
|
| Sign me out of Free Code Camp
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='mailto:team@freecodecamp.com')
|
||||||
|
span.ion-email
|
||||||
|
| Email us at team@freecodecamp.com
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-danger.btn-link-social.confirm-deletion
|
||||||
|
span.ion-trash-b
|
||||||
|
| Delete my Free Code Camp account
|
||||||
|
script.
|
||||||
|
$('.confirm-deletion').on("click", function () {
|
||||||
|
$('#modal-dialog').modal('show');
|
||||||
|
});
|
||||||
|
#modal-dialog.modal.animated.wobble
|
||||||
|
.modal-dialog
|
||||||
|
.modal-content
|
||||||
|
.modal-header
|
||||||
|
a.close(href='#', data-dismiss='modal', aria-hidden='true') ×
|
||||||
|
h3 You don't really want to delete your account, do you?
|
||||||
|
.modal-body
|
||||||
|
p This will really delete all your data, including all your progress, news stories and brownie points.
|
||||||
|
p We won't be able to recover any of it for you later, even if you change your mind.
|
||||||
|
p If there's something we could do better, send us an email instead and we'll do our best:  
|
||||||
|
a(href="mailto:team@freecodecamp.com") team@freecodecamp.com
|
||||||
|
| .
|
||||||
|
.modal-footer
|
||||||
|
a.btn.btn-success.btn-block(href='#', data-dismiss='modal', aria-hidden='true')
|
||||||
|
span.ion-happy
|
||||||
|
| Nevermind, I don't want to delete all my progress
|
||||||
|
.btn-spacer
|
||||||
|
form(action='/account/delete', method='POST')
|
||||||
|
input(type='hidden', name='_csrf', value=_csrf)
|
||||||
|
button.btn.btn-danger.btn-block(type='submit')
|
||||||
|
span.ion-trash-b
|
||||||
|
| I am 100% sure I want to delete all my progress
|
||||||
.panel.panel-info
|
.panel.panel-info
|
||||||
.panel-heading.text-center
|
.panel-heading.text-center
|
||||||
h1 #{username}'s portfolio
|
h1 #{username}'s portfolio
|
||||||
.panel-body
|
.panel-body
|
||||||
if (user && user.username === username)
|
|
||||||
.row.text-center
|
.row.text-center
|
||||||
.col-xs-12.col-sm-10.col-sm-offset-1
|
.col-xs-12.col-sm-10.col-sm-offset-1
|
||||||
a.btn.btn-big.btn-primary.btn-block(href="/account") Manage my account
|
a.btn.btn-big.btn-primary.btn-block(href="/account") Manage my account
|
||||||
|
@ -20,15 +20,8 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height
|
|||||||
li
|
li
|
||||||
a.btn.signup-btn.signup-btn-nav(href='/login') Sign in
|
a.btn.signup-btn.signup-btn-nav(href='/login') Sign in
|
||||||
else
|
else
|
||||||
if user.isGithubCool
|
|
||||||
li
|
li
|
||||||
a(href='/' + user.username) [ #{user.progressTimestamps.length} ]
|
a(href='/' + user.username) [ #{user.progressTimestamps.length} ]
|
||||||
.hidden-xs.hidden-sm
|
.hidden-xs.hidden-sm
|
||||||
a(href='/' + user.username)
|
a(href='/' + user.username)
|
||||||
img.profile-picture.float-right(src='#{user.picture}')
|
img.profile-picture.float-right(src='#{user.picture}')
|
||||||
else
|
|
||||||
li
|
|
||||||
a(href='/account') [ #{user.progressTimestamps.length} ]
|
|
||||||
.hidden-xs.hidden-sm
|
|
||||||
a(href='/account')
|
|
||||||
img.profile-picture.float-right(src='#{user.picture}')
|
|
||||||
|
Reference in New Issue
Block a user