- cleaned some code.
- routing offline - pushNotification
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user