Skip to content

Instantly share code, notes, and snippets.

@terakilobyte
Created January 13, 2015 15:57
Show Gist options
  • Save terakilobyte/6ba7dbcea5805a840f08 to your computer and use it in GitHub Desktop.
Save terakilobyte/6ba7dbcea5805a840f08 to your computer and use it in GitHub Desktop.
/**
* In Express
*/
exports.getAccount = function(req, res) {
Challenge.find({}, null, { sort: { challengeNumber: 1 } }, function(err, c) {
if (err) {
console.error('Challenge err: ', err);
next(err);
}
res.render('account/profile', {
title: 'Manage your Free Code Camp Account',
challenges: c,
ch: req.user.challengesHash,
moment: moment,
user: req.user
});
});
};
/**
* In my Angular controlelr
*/
profileValidation.controller('profileValidationController', ['$scope',
function($scope) {
$scope.user = window.user;
console.log($scope.user);
$scope.user.profile.username = $scope.user.profile.username ? $scope.user.profile.username.toLowerCase() : undefined;
$scope.storedUsername = data.user.profile.username;
$scope.storedEmail = data.user.email;
$scope.user.email = $scope.user.email ? $scope.user.email.toLowerCase() : undefined;
$scope.user.profile.twitterHandle = $scope.user.profile.twitterHandle ? $scope.user.profile.twitterHandle.toLowerCase() : undefined;
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment