Harden showCert against errors
parent
aaac06fda3
commit
ba88def035
|
@ -319,11 +319,12 @@ module.exports = function(app) {
|
|||
showFront && user.isFrontEndCert ||
|
||||
!showFront && user.isFullStackCert
|
||||
) {
|
||||
var { completedDate } = _.find(user.completedChallenges, {
|
||||
id: showFront ?
|
||||
frontEndChallangeId :
|
||||
fullStackChallangeId
|
||||
});
|
||||
var { completedDate = new Date() } =
|
||||
_.find(user.completedChallenges, {
|
||||
id: showFront ?
|
||||
frontEndChallangeId :
|
||||
fullStackChallangeId
|
||||
}) || {};
|
||||
|
||||
return res.render(
|
||||
showFront ?
|
||||
|
@ -342,7 +343,7 @@ module.exports = function(app) {
|
|||
`Looks like user ${username} is not Front End certified` :
|
||||
`Looks like user ${username} is not Full Stack certified`
|
||||
});
|
||||
res.redirect('/map');
|
||||
res.redirect('back');
|
||||
},
|
||||
next
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue