superdev810 / webrtc

This app is used easyrtc, whiteboard, pdf share, image share, video share and multi/single chat function by nodejs and expres framework with ejs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Homepage, how to redirect to users/signin page?

Leadrive opened this issue · comments

Hi,
controllers/home.js

  ip = 'owner-test-ip';
  Users.findOne({ip_address: ip}, function(err, result){
    if (!err && result){
      // request to moximo server for detect email and token : {email: result.email, token: result.password}
      req.body = {
        email: result.email,
        password: result.password
      };
      AuthController.sign_in(req, res, function(err, user){
        //if (err)
        //  return res.redirect('http://moximo.com');
        var ctx = {title: config.app.title, error: null};
        res.render('owner/create_room', ctx);
      })
    }
    else {
      // redirect to moximo site
      res.redirect(config.mainServer);
    }
  })

Now, the users table is empty, the program will redirect to moximo site.
How to redirect to the user sign in page?
Thank you.

If user not exist in db, it redirect to main site.
Originally, in the development mode, you should insert two test user in the user table based on user table structure