summaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-05-21 22:48:00 +0800
committerCheng-Han, Wu2016-05-21 22:48:00 +0800
commit6405bb505695a5592efe8aa8d5bde9e723fadfc0 (patch)
tree882c74f212d4892ae0013d5ab394404f096b693b /app.js
parent900141daff05feeeaae5f537d2f53862b7200651 (diff)
Add support of google signin
Diffstat (limited to 'app.js')
-rw-r--r--app.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/app.js b/app.js
index 5e75ac59..4b4e1766 100644
--- a/app.js
+++ b/app.js
@@ -317,6 +317,19 @@ if (config.dropbox) {
res.redirect(config.serverurl);
});
}
+//google auth
+if (config.google) {
+ app.get('/auth/google',
+ passport.authenticate('google', { scope: ['profile'] }));
+ //google auth callback
+ app.get('/auth/google/callback',
+ passport.authenticate('google', {
+ failureRedirect: config.serverurl
+ }),
+ function (req, res) {
+ res.redirect(config.serverurl);
+ });
+}
//logout
app.get('/logout', function (req, res) {
if (config.debug && req.isAuthenticated())