Added GitHub and Slack authentication integrations
This commit is contained in:
@@ -123,7 +123,7 @@ router.post('/users/create', (req, res) => {
|
||||
|
||||
if (!validator.isEmail(nUsr.email)) {
|
||||
return res.status(400).json({ msg: 'Invalid email address' })
|
||||
} else if (!validator.isIn(nUsr.provider, ['local', 'google', 'windowslive', 'facebook'])) {
|
||||
} else if (!validator.isIn(nUsr.provider, ['local', 'google', 'windowslive', 'facebook', 'github', 'slack'])) {
|
||||
return res.status(400).json({ msg: 'Invalid provider' })
|
||||
} else if (nUsr.provider === 'local' && !validator.isLength(nUsr.password, { min: 6 })) {
|
||||
return res.status(400).json({ msg: 'Password too short or missing' })
|
||||
|
@@ -64,10 +64,14 @@ router.post('/login', bruteforce.prevent, function (req, res, next) {
|
||||
router.get('/login/ms', passport.authenticate('windowslive', { scope: ['wl.signin', 'wl.basic', 'wl.emails'] }))
|
||||
router.get('/login/google', passport.authenticate('google', { scope: ['profile', 'email'] }))
|
||||
router.get('/login/facebook', passport.authenticate('facebook', { scope: ['public_profile', 'email'] }))
|
||||
router.get('/login/github', passport.authenticate('github', { scope: ['user:email'] }))
|
||||
router.get('/login/slack', passport.authenticate('slack', { scope: ['identity.basic', 'identity.email'] }))
|
||||
|
||||
router.get('/login/ms/callback', passport.authenticate('windowslive', { failureRedirect: '/login', successRedirect: '/' }))
|
||||
router.get('/login/google/callback', passport.authenticate('google', { failureRedirect: '/login', successRedirect: '/' }))
|
||||
router.get('/login/facebook/callback', passport.authenticate('facebook', { failureRedirect: '/login', successRedirect: '/' }))
|
||||
router.get('/login/github/callback', passport.authenticate('github', { failureRedirect: '/login', successRedirect: '/' }))
|
||||
router.get('/login/slack/callback', passport.authenticate('slack', { failureRedirect: '/login', successRedirect: '/' }))
|
||||
|
||||
/**
|
||||
* Logout
|
||||
|
Reference in New Issue
Block a user