Przeglądaj źródła

check req.user strictly when registration

Yuki Takei 7 lat temu
rodzic
commit
4b5639fb2f
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      src/server/routes/login.js

+ 4 - 2
src/server/routes/login.js

@@ -139,8 +139,10 @@ module.exports = function(crowi, app) {
   actions.register = function(req, res) {
   actions.register = function(req, res) {
     const googleAuth = require('../util/googleAuth')(crowi);
     const googleAuth = require('../util/googleAuth')(crowi);
 
 
-    // ログイン済みならさようなら
-    if (req.user) {
+    // redirect to '/' if both of these are true:
+    //  1. user has logged in
+    //  2. req.user is not username/email string (which is set by basic-auth-connect)
+    if (req.user != null && req.user instanceof Object) {
       return res.redirect('/');
       return res.redirect('/');
     }
     }