update sign in flow (#10873)
* update sign in flow and simplify welcome page slightly
This commit is contained in:
committed by
Justin Richardsson
parent
0df0e1ee3f
commit
813edb5dbc
@ -67,10 +67,6 @@ module.exports = function(app) {
|
|||||||
User.afterRemote('create', function({ req, res }, user, next) {
|
User.afterRemote('create', function({ req, res }, user, next) {
|
||||||
debug('user created, sending email');
|
debug('user created, sending email');
|
||||||
if (!user.email || !isEmail(user.email)) { return next(); }
|
if (!user.email || !isEmail(user.email)) { return next(); }
|
||||||
const redirect = req.session && req.session.returnTo ?
|
|
||||||
req.session.returnTo :
|
|
||||||
'/';
|
|
||||||
|
|
||||||
var mailOptions = {
|
var mailOptions = {
|
||||||
type: 'email',
|
type: 'email',
|
||||||
to: user.email,
|
to: user.email,
|
||||||
@ -92,13 +88,7 @@ module.exports = function(app) {
|
|||||||
debug('sending welcome email');
|
debug('sending welcome email');
|
||||||
return user.verify(mailOptions, function(err) {
|
return user.verify(mailOptions, function(err) {
|
||||||
if (err) { return next(err); }
|
if (err) { return next(err); }
|
||||||
req.flash('success', {
|
return res.redirect('/welcome');
|
||||||
msg: [ 'Congratulations ! We\'ve created your account. ',
|
|
||||||
'Please check your email. We sent you a link that you can ',
|
|
||||||
'click to verify your email address and then login.'
|
|
||||||
].join('')
|
|
||||||
});
|
|
||||||
return res.redirect(redirect);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -26,6 +26,7 @@ module.exports = function(app) {
|
|||||||
router.get('/shop/confirm-stickers', confirmStickers);
|
router.get('/shop/confirm-stickers', confirmStickers);
|
||||||
router.get('/all-stories', showAllTestimonials);
|
router.get('/all-stories', showAllTestimonials);
|
||||||
router.get('/terms', terms);
|
router.get('/terms', terms);
|
||||||
|
router.get('/welcome', welcome);
|
||||||
router.get('/privacy', privacy);
|
router.get('/privacy', privacy);
|
||||||
router.get('/how-nonprofit-projects-work', howNonprofitProjectsWork);
|
router.get('/how-nonprofit-projects-work', howNonprofitProjectsWork);
|
||||||
router.get(
|
router.get(
|
||||||
@ -57,6 +58,12 @@ module.exports = function(app) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function welcome(req, res) {
|
||||||
|
res.render('resources/welcome', {
|
||||||
|
title: 'Welcome to Free Code Camp!'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function howNonprofitProjectsWork(req, res) {
|
function howNonprofitProjectsWork(req, res) {
|
||||||
res.render('resources/how-nonprofit-projects-work', {
|
res.render('resources/how-nonprofit-projects-work', {
|
||||||
title: 'How our nonprofit projects work'
|
title: 'How our nonprofit projects work'
|
||||||
|
@ -1,30 +1,23 @@
|
|||||||
extends ../layout
|
extends ../layout
|
||||||
block content
|
block content
|
||||||
.text-center
|
.text-center
|
||||||
h2 New to Free Code Camp?
|
h2 Are you new to Free Code Camp?
|
||||||
br
|
.spacer
|
||||||
.button-spacer
|
|
||||||
| Sign up now:
|
|
||||||
a.btn.btn-lg.btn-block.btn-social.btn-primary(href='/email-signup')
|
a.btn.btn-lg.btn-block.btn-social.btn-primary(href='/email-signup')
|
||||||
i.fa.fa-envelope
|
i.fa.fa-envelope
|
||||||
| Sign up with Email
|
| Sign up with Email
|
||||||
a.btn.btn-lg.btn-block.btn-social.btn-github(href='/auth/github')
|
|
||||||
i.fa.fa-github
|
|
||||||
| Sign up with GitHub
|
|
||||||
.spacer
|
.spacer
|
||||||
hr
|
hr
|
||||||
.spacer
|
.spacer
|
||||||
h2 Are you a returning camper?
|
h2 Are you a returning camper?
|
||||||
br
|
.spacer
|
||||||
.button-spacer
|
|
||||||
| Sign in with one of these options:
|
|
||||||
a.btn.btn-lg.btn-block.btn-social.btn-primary(href='/email-signin')
|
a.btn.btn-lg.btn-block.btn-social.btn-primary(href='/email-signin')
|
||||||
i.fa.fa-envelope
|
i.fa.fa-envelope
|
||||||
| Sign in with Email
|
| Sign in with Email
|
||||||
a.btn.btn-lg.btn-block.btn-social.btn-github(href='/auth/github')
|
a.btn.btn-lg.btn-block.btn-social.btn-github(href='/auth/github')
|
||||||
i.fa.fa-github
|
i.fa.fa-github
|
||||||
| Sign in with GitHub
|
| Sign in with GitHub
|
||||||
br
|
.button-spacer
|
||||||
p
|
p
|
||||||
a(href="/deprecated-signin") Click here if you previously signed in using a different method.
|
a(href="/deprecated-signin") Click here if you previously signed in using a different method.
|
||||||
|
|
||||||
|
22
server/views/resources/welcome.jade
Normal file
22
server/views/resources/welcome.jade
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
extends ../layout
|
||||||
|
block content
|
||||||
|
.row
|
||||||
|
.col-xs-12.col-sm-10.col-sm-offset-1.col-md-6.col-md-offset-3.text-center
|
||||||
|
h1 Welcome to Free Code Camp!
|
||||||
|
p You have created a brand new account.
|
||||||
|
p Already have an account?  
|
||||||
|
a(href='/signout') Sign out, then sign in with a different email address.
|
||||||
|
.spacer
|
||||||
|
hr
|
||||||
|
.spacer
|
||||||
|
p Can we show you how to join our chat rooms and local study groups?
|
||||||
|
p It only takes a few minutes.
|
||||||
|
.spacer
|
||||||
|
.row
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-primary.btn-link-social(href='/')
|
||||||
|
| Yes, I want to join the community
|
||||||
|
.row
|
||||||
|
.col-xs-12
|
||||||
|
a.btn.btn-lg.btn-block.btn-danger.btn-link-social(href='/map')
|
||||||
|
| No, I want to start coding immediately
|
Reference in New Issue
Block a user