Merge pull request #3550 from FreeCodeCamp/merge-account-page
Merge account page
This commit is contained in:
@ -133,6 +133,10 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
|
"lockdownMode": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
"currentChallenge": {
|
"currentChallenge": {
|
||||||
"type": {}
|
"type": {}
|
||||||
},
|
},
|
||||||
|
@ -210,6 +210,7 @@ module.exports = function(app) {
|
|||||||
|
|
||||||
function returnIndividualChallenge(req, res, next) {
|
function returnIndividualChallenge(req, res, next) {
|
||||||
const origChallengeName = req.params.challengeName;
|
const origChallengeName = req.params.challengeName;
|
||||||
|
const solutionCode = req.query.solution;
|
||||||
const unDashedName = unDasherize(origChallengeName);
|
const unDashedName = unDasherize(origChallengeName);
|
||||||
|
|
||||||
const challengeName = challengesRegex.test(unDashedName) ?
|
const challengeName = challengesRegex.test(unDashedName) ?
|
||||||
@ -239,7 +240,12 @@ module.exports = function(app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dasherize(challenge.name) !== origChallengeName) {
|
if (dasherize(challenge.name) !== origChallengeName) {
|
||||||
return Observable.just('/challenges/' + dasherize(challenge.name));
|
return Observable.just(
|
||||||
|
'/challenges/' +
|
||||||
|
dasherize(challenge.name) +
|
||||||
|
'?solution=' +
|
||||||
|
encodeURIComponent(solutionCode)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save user does nothing if user does not exist
|
// save user does nothing if user does not exist
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import _ from 'lodash';
|
import dedent from 'dedent';
|
||||||
import async from 'async';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import debugFactory from 'debug';
|
import debugFactory from 'debug';
|
||||||
|
|
||||||
import { ifNoUser401 } from '../utils/middleware';
|
import { ifNoUser401, ifNoUserRedirectTo } from '../utils/middleware';
|
||||||
|
|
||||||
const debug = debugFactory('freecc:boot:user');
|
const debug = debugFactory('freecc:boot:user');
|
||||||
const daysBetween = 1.5;
|
const daysBetween = 1.5;
|
||||||
|
const sendNonUserToMap = ifNoUserRedirectTo('/map');
|
||||||
|
|
||||||
function calcCurrentStreak(cals) {
|
function calcCurrentStreak(cals) {
|
||||||
const revCals = cals.concat([Date.now()]).slice().reverse();
|
const revCals = cals.concat([Date.now()]).slice().reverse();
|
||||||
@ -52,7 +52,7 @@ function dayDiff([head, tail]) {
|
|||||||
module.exports = function(app) {
|
module.exports = function(app) {
|
||||||
var router = app.loopback.Router();
|
var router = app.loopback.Router();
|
||||||
var User = app.models.User;
|
var User = app.models.User;
|
||||||
var Story = app.models.Story;
|
// var Story = app.models.Story;
|
||||||
|
|
||||||
router.get('/login', function(req, res) {
|
router.get('/login', function(req, res) {
|
||||||
res.redirect(301, '/signin');
|
res.redirect(301, '/signin');
|
||||||
@ -68,14 +68,21 @@ 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.get(
|
||||||
|
'/toggle-lockdown-mode',
|
||||||
|
sendNonUserToMap,
|
||||||
|
toggleLockdownMode
|
||||||
|
);
|
||||||
router.post(
|
router.post(
|
||||||
'/account/delete',
|
'/account/delete',
|
||||||
ifNoUser401,
|
ifNoUser401,
|
||||||
postDeleteAccount
|
postDeleteAccount
|
||||||
);
|
);
|
||||||
router.get('/account/unlink/:provider', getOauthUnlink);
|
router.get(
|
||||||
router.get('/account', getAccount);
|
'/account',
|
||||||
|
sendNonUserToMap,
|
||||||
|
getAccount
|
||||||
|
);
|
||||||
router.get('/vote1', vote1);
|
router.get('/vote1', vote1);
|
||||||
router.get('/vote2', vote2);
|
router.get('/vote2', vote2);
|
||||||
// Ensure this is the last route!
|
// Ensure this is the last route!
|
||||||
@ -116,18 +123,8 @@ module.exports = function(app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAccount(req, res) {
|
function getAccount(req, res) {
|
||||||
if (!req.user) {
|
const { username } = req.user;
|
||||||
return res.redirect('/');
|
return res.redirect('/' + username);
|
||||||
}
|
|
||||||
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) {
|
||||||
@ -145,14 +142,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
|
||||||
@ -214,6 +203,37 @@ module.exports = function(app) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleLockdownMode(req, res, next) {
|
||||||
|
if (req.user.lockdownMode === true) {
|
||||||
|
req.user.lockdownMode = false;
|
||||||
|
return req.user.save(function(err) {
|
||||||
|
if (err) { return next(err); }
|
||||||
|
|
||||||
|
req.flash('success', {
|
||||||
|
msg: dedent`
|
||||||
|
Other people can now view all your challenge solutions.
|
||||||
|
You can change this back at any time in the "Manage My Account"
|
||||||
|
section at the bottom of this page.
|
||||||
|
`
|
||||||
|
});
|
||||||
|
res.redirect('/' + req.user.username);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
req.user.lockdownMode = true;
|
||||||
|
return req.user.save(function(err) {
|
||||||
|
if (err) { return next(err); }
|
||||||
|
|
||||||
|
req.flash('success', {
|
||||||
|
msg: dedent`
|
||||||
|
All your challenge solutions are now hidden from other people.
|
||||||
|
You can change this back at any time in the "Manage My Account"
|
||||||
|
section at the bottom of this page.
|
||||||
|
`
|
||||||
|
});
|
||||||
|
res.redirect('/' + req.user.username);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function postDeleteAccount(req, res, next) {
|
function postDeleteAccount(req, res, next) {
|
||||||
User.destroyById(req.user.id, function(err) {
|
User.destroyById(req.user.id, function(err) {
|
||||||
if (err) { return next(err); }
|
if (err) { return next(err); }
|
||||||
@ -223,25 +243,6 @@ module.exports = function(app) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOauthUnlink(req, res, next) {
|
|
||||||
var provider = req.params.provider;
|
|
||||||
User.findById(req.user.id, function(err, user) {
|
|
||||||
if (err) { return next(err); }
|
|
||||||
|
|
||||||
user[provider] = null;
|
|
||||||
user.tokens =
|
|
||||||
_.reject(user.tokens, function(token) {
|
|
||||||
return token.kind === provider;
|
|
||||||
});
|
|
||||||
|
|
||||||
user.save(function(err) {
|
|
||||||
if (err) { return next(err); }
|
|
||||||
req.flash('info', { msg: provider + ' account has been unlinked.' });
|
|
||||||
res.redirect('/account');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getReset(req, res) {
|
function getReset(req, res) {
|
||||||
if (!req.accessToken) {
|
if (!req.accessToken) {
|
||||||
req.flash('errors', { msg: 'access token invalid' });
|
req.flash('errors', { msg: 'access token invalid' });
|
||||||
@ -314,6 +315,7 @@ module.exports = function(app) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
function updateUserStoryPictures(userId, picture, username, cb) {
|
function updateUserStoryPictures(userId, picture, username, cb) {
|
||||||
Story.find({ 'author.userId': userId }, function(err, stories) {
|
Story.find({ 'author.userId': userId }, function(err, stories) {
|
||||||
if (err) { return cb(err); }
|
if (err) { return cb(err); }
|
||||||
@ -334,14 +336,14 @@ module.exports = function(app) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
function vote1(req, res) {
|
function vote1(req, res, next) {
|
||||||
if (req.user) {
|
if (req.user) {
|
||||||
req.user.tshirtVote = 1;
|
req.user.tshirtVote = 1;
|
||||||
req.user.save(function(err) {
|
req.user.save(function(err) {
|
||||||
if (err) {
|
if (err) { return next(err); }
|
||||||
return next(err);
|
|
||||||
}
|
|
||||||
req.flash('success', { msg: 'Thanks for voting!' });
|
req.flash('success', { msg: 'Thanks for voting!' });
|
||||||
res.redirect('/map');
|
res.redirect('/map');
|
||||||
});
|
});
|
||||||
@ -351,13 +353,12 @@ module.exports = function(app) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function vote2(req, res) {
|
function vote2(req, res, next) {
|
||||||
if (req.user) {
|
if (req.user) {
|
||||||
req.user.tshirtVote = 2;
|
req.user.tshirtVote = 2;
|
||||||
req.user.save(function(err) {
|
req.user.save(function(err) {
|
||||||
if (err) {
|
if (err) { return next(err); }
|
||||||
return next(err);
|
|
||||||
}
|
|
||||||
req.flash('success', { msg: 'Thanks for voting!' });
|
req.flash('success', { msg: 'Thanks for voting!' });
|
||||||
res.redirect('/map');
|
res.redirect('/map');
|
||||||
});
|
});
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
extends ../layout
|
|
||||||
block content
|
|
||||||
script.
|
|
||||||
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,21 +3,43 @@ 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 Update Your Portfolio
|
||||||
|
.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)
|
||||||
|
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)
|
||||||
|
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)
|
||||||
|
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)
|
||||||
|
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
|
||||||
|
|
||||||
.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
|
|
||||||
.col-xs-12.col-sm-10.col-sm-offset-1
|
|
||||||
a.btn.btn-big.btn-primary.btn-block(href="/account") Manage my account
|
|
||||||
.button-spacer
|
|
||||||
.col-xs-12.col-sm-10.col-sm-offset-1
|
|
||||||
a.btn.btn-big.btn-success.btn-block(href="/signout") Sign out of Free Code Camp
|
|
||||||
.spacer
|
|
||||||
.row
|
.row
|
||||||
.col-xs-12
|
.col-xs-12.col-sm-10.col-sm-offset-1.col-md-8.col-md-offset-2.text-center
|
||||||
.col-xs-12.col-sm-12.col-md-5
|
|
||||||
if picture
|
if picture
|
||||||
img.img-center.img-responsive.public-profile-img(src=picture)
|
img.img-center.img-responsive.public-profile-img(src=picture)
|
||||||
else
|
else
|
||||||
@ -33,18 +55,14 @@ block content
|
|||||||
a.fa.fa-facebook-square.text-primary(title="@#{username}'s Facebook Profile", href='https://facebook.com/' + facebook, target='_blank')
|
a.fa.fa-facebook-square.text-primary(title="@#{username}'s Facebook Profile", href='https://facebook.com/' + facebook, target='_blank')
|
||||||
if (google)
|
if (google)
|
||||||
a.fa.fa-google-plus-square.text-primary(title="@#{username}'s Google Profile", href='https://plus.google.com/' + google, target='_blank')
|
a.fa.fa-google-plus-square.text-primary(title="@#{username}'s Google Profile", href='https://plus.google.com/' + google, target='_blank')
|
||||||
.visible-md.visible-lg
|
|
||||||
.col-xs-12.col-sm-12.col-md-4.text-justify
|
|
||||||
h1.flat-top.wrappable= name
|
h1.flat-top.wrappable= name
|
||||||
h3.flat-top.bolded.wrappable= location
|
h1.flat-top.wrappable= location
|
||||||
.visible-xs.visible-sm
|
h1.flat-top.text-primary= "[ " + (progressTimestamps.length) + " ]"
|
||||||
.col-xs-12.col-sm-12.col-md-4.text-center
|
if (user && user.username !== username)
|
||||||
h1.flat-top.wrappable= name
|
a.btn.btn-lg.btn-block.btn-twitter.btn-link-social(href='/link/twitter')
|
||||||
h3.flat-top.bolded.wrappable= location
|
i.fa.fa-plus-square
|
||||||
.col-xs-12.col-sm-12.col-md-3.text-center
|
| Add them to my personal leaderboard
|
||||||
.background-svg.img-center
|
|
||||||
.points-on-top
|
|
||||||
= "[ " + (progressTimestamps.length) + " ]"
|
|
||||||
.spacer
|
.spacer
|
||||||
.hidden-xs.hidden-sm.col-md-12
|
.hidden-xs.hidden-sm.col-md-12
|
||||||
#cal-heatmap.d3-centered
|
#cal-heatmap.d3-centered
|
||||||
@ -79,12 +97,13 @@ block content
|
|||||||
h4.col-sm-6.text-left Current Streak: #{currentStreak} #{currentStreak + currentStreak === 1 ? ' day' : ' days'}
|
h4.col-sm-6.text-left Current Streak: #{currentStreak} #{currentStreak + currentStreak === 1 ? ' day' : ' days'}
|
||||||
|
|
||||||
|
|
||||||
|
if (user.username == username || !user.lockdownMode)
|
||||||
if (challenges.length > 0)
|
if (challenges.length > 0)
|
||||||
.col-sm-12
|
.col-sm-12
|
||||||
table.table.table-striped
|
table.table.table-striped
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th.col-xs-4 Challenge
|
th.col-xs-4 Project
|
||||||
th.col-xs-2 Completed
|
th.col-xs-2 Completed
|
||||||
th.col-xs-6 Link
|
th.col-xs-6 Link
|
||||||
for challenge in challenges
|
for challenge in challenges
|
||||||
@ -93,9 +112,7 @@ block content
|
|||||||
a(href='/challenges/' + challenge.name, target='_blank')= challenge.name
|
a(href='/challenges/' + challenge.name, target='_blank')= challenge.name
|
||||||
td.col-xs-2= moment(challenge.completedDate, 'x').format("MMM DD, YYYY")
|
td.col-xs-2= moment(challenge.completedDate, 'x').format("MMM DD, YYYY")
|
||||||
td.col-xs-6
|
td.col-xs-6
|
||||||
a(href=challenge.solution, target='_blank') View my solution
|
a(href=challenge.solution, target='_blank') View my project
|
||||||
if (user && user.username === username)
|
|
||||||
br
|
|
||||||
if (bonfires.length > 0)
|
if (bonfires.length > 0)
|
||||||
.col-sm-12
|
.col-sm-12
|
||||||
table.table.table-striped
|
table.table.table-striped
|
||||||
@ -106,9 +123,60 @@ block content
|
|||||||
th.col-xs-6 Solution
|
th.col-xs-6 Solution
|
||||||
for bonfire in bonfires
|
for bonfire in bonfires
|
||||||
tr
|
tr
|
||||||
td.col-xs-4
|
td.col-xs-4= bonfire.name
|
||||||
a(href='/challenges/' + bonfire.name, target='_blank')= bonfire.name
|
|
||||||
td.col-xs-2= moment(bonfire.completedDate, 'x').format("MMM DD, YYYY")
|
td.col-xs-2= moment(bonfire.completedDate, 'x').format("MMM DD, YYYY")
|
||||||
td.col-xs-6
|
td.col-xs-6
|
||||||
pre.wrappable= bonfire.solution
|
a(href='/challenges/' + bonfire.name + '?solution=' + encodeURIComponent(bonfire.solution), target='_blank') View my solution
|
||||||
br
|
|
||||||
|
if (user && user.username === username)
|
||||||
|
.panel.panel-info
|
||||||
|
.panel-heading.text-center Manage Your Account
|
||||||
|
.panel-body
|
||||||
|
.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
|
||||||
|
if (!user.lockdownMode)
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-info.btn-link-social(href='/toggle-lockdown-mode')
|
||||||
|
span.ion-locked
|
||||||
|
| Hide all my solutions from other people
|
||||||
|
else
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-info.btn-link-social(href='/toggle-lockdown-mode')
|
||||||
|
span.ion-unlocked
|
||||||
|
| Let other people see all my solutions
|
||||||
|
.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-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
|
||||||
|
@ -22,31 +22,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}')
|
|
||||||
script.
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('.learn-btn').click(function(e) {
|
|
||||||
var challengeDashedName = null;
|
|
||||||
e.preventDefault();
|
|
||||||
if (typeof dashedName === "string") {
|
|
||||||
return location.reload();
|
|
||||||
}
|
|
||||||
if (typeof localStorage !== 'undefined') {
|
|
||||||
challengeDashedName = localStorage.getItem('currentDashedName');
|
|
||||||
}
|
|
||||||
window.location = challengeDashedName ?
|
|
||||||
'/challenges/' + challengeDashedName :
|
|
||||||
'/map';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
Reference in New Issue
Block a user