- cleaned some code.

- routing offline
- pushNotification
This commit is contained in:
Paolo Arena
2019-02-12 12:06:25 +01:00
parent d24b232a2d
commit 71132b9a57
8 changed files with 219 additions and 92 deletions

View File

@@ -8,11 +8,12 @@ var authenticate = (req, res, next) => {
var token = req.header('x-auth');
const useragent = req.get('User-Agent');
const access = 'auth ' + useragent;
// tools.mylog("TOKEN = ", token);
// tools.mylog("USER-AGENT = ", useragent);
tools.mylog("TOKEN = ", token);
tools.mylog("USER-AGENT = ", useragent);
User.findByToken(token, 'auth ' + useragent).then((user) => {
User.findByToken(token, access).then((user) => {
if (!user) {
tools.mylog("TOKEN NOT FOUND! Maybe Connected to other Page");
return Promise.reject(server_constants.RIS_CODE_HTTP_INVALID_TOKEN);
@@ -22,6 +23,7 @@ var authenticate = (req, res, next) => {
req.user = user;
req.token = token;
req.access = access;
next();
}).catch((e) => {
tools.mylog("ERR =", e);