Browse Source

Fix googleAuth

Sotaro KARASAWA 10 năm trước cách đây
mục cha
commit
385cf268c3
3 tập tin đã thay đổi với 6 bổ sung7 xóa
  1. 3 3
      lib/routes/login.js
  2. 2 2
      lib/routes/me.js
  3. 1 2
      lib/util/googleAuth.js

+ 3 - 3
lib/routes/login.js

@@ -82,7 +82,7 @@ module.exports = function(crowi, app) {
   };
   };
 
 
   actions.loginGoogle = function(req, res) {
   actions.loginGoogle = function(req, res) {
-    var googleAuth = require('../util/googleAuth')(app);
+    var googleAuth = require('../util/googleAuth')(config);
     var code = req.session.googleAuthCode || null;
     var code = req.session.googleAuthCode || null;
 
 
     if (!code) {
     if (!code) {
@@ -134,7 +134,7 @@ module.exports = function(crowi, app) {
   };
   };
 
 
   actions.register = function(req, res) {
   actions.register = function(req, res) {
-    var googleAuth = require('../util/googleAuth')(app);
+    var googleAuth = require('../util/googleAuth')(config);
 
 
     // ログイン済みならさようなら
     // ログイン済みならさようなら
     if (req.user) {
     if (req.user) {
@@ -269,7 +269,7 @@ module.exports = function(crowi, app) {
   };
   };
 
 
   actions.registerGoogle = function(req, res) {
   actions.registerGoogle = function(req, res) {
-    var googleAuth = require('../util/googleAuth')(app);
+    var googleAuth = require('../util/googleAuth')(config);
     googleAuth.createAuthUrl(req, function(err, redirectUrl) {
     googleAuth.createAuthUrl(req, function(err, redirectUrl) {
       if (err) {
       if (err) {
         // TODO
         // TODO

+ 2 - 2
lib/routes/me.js

@@ -179,7 +179,7 @@ module.exports = function(crowi, app) {
   };
   };
 
 
   actions.authGoogle = function(req, res) {
   actions.authGoogle = function(req, res) {
-    var googleAuth = require('../util/googleAuth')(app);
+    var googleAuth = require('../util/googleAuth')(config);
 
 
     var userData = req.user;
     var userData = req.user;
 
 
@@ -206,7 +206,7 @@ module.exports = function(crowi, app) {
   };
   };
 
 
   actions.authGoogleCallback = function(req, res) {
   actions.authGoogleCallback = function(req, res) {
-    var googleAuth = require('../util/googleAuth')(app);
+    var googleAuth = require('../util/googleAuth')(config);
     var userData = req.user;
     var userData = req.user;
 
 
     googleAuth.handleCallback(req, function(err, tokenInfo) {
     googleAuth.handleCallback(req, function(err, tokenInfo) {

+ 1 - 2
lib/util/googleAuth.js

@@ -2,12 +2,11 @@
  * googleAuth utility
  * googleAuth utility
  */
  */
 
 
-module.exports = function(app) {
+module.exports = function(config) {
   'use strict';
   'use strict';
 
 
   var googleapis = require('googleapis')
   var googleapis = require('googleapis')
     , debug = require('debug')('crowi:lib:googleAuth')
     , debug = require('debug')('crowi:lib:googleAuth')
-    , config = app.set('config')
     , lib = {}
     , lib = {}
     ;
     ;