Skip to content

Commit

Permalink
v2.2.0: fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
npeditto committed Aug 2, 2018
1 parent f3cc008 commit a47193e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/management/mng_auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ var computeCredentials = function (b_pw, b_pub_key, callback) {
response.message = "credentials";
response.result = "SUCCESS";
response.hash_pw = pw_result.message;
response.gen_pw = gen_pw;
callback(response);

}
Expand Down
16 changes: 12 additions & 4 deletions lib/management/mng_board.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,8 @@ board_utils = function (session, rest) {
var hash_b_pw = credentials.hash_pw;
var b_pub_key = credentials.pub_key;

console.log(credentials);

db.regBoard(board_id, board_label, latitude, longitude, altitude, net_enabled, sensorslist, layout_id, description,
extra, project_id, user_id, mobile, position_refr_time, notify, notify_rate, notify_retry, b_pub_key, hash_b_pw,

Expand All @@ -530,7 +532,10 @@ board_utils = function (session, rest) {
if (db_result.result === "SUCCESS") {

logger.info("[SYSTEM] --> Registration of board '" + board_id + "' successfully completed!");
db_result.password = b_pw;
if(b_pw == "" || b_pw == undefined){
db_result.password = credentials.gen_pw;
}else
db_result.password = b_pw;

res.status(200).send(db_result);

Expand Down Expand Up @@ -792,7 +797,9 @@ board_utils = function (session, rest) {
var localISOTime = (new Date(Date.now() - tzoffset)).toISOString();
position.timestamp=localISOTime;

session.call('s4t.' + board + '.board.setBoardPosition', [position]).then(
console.log("position @ " + position.timestamp);

session_wamp.call('s4t.' + board + '.board.setBoardPosition', [position]).then(

function (conf_result) {
response.message = db_result.message + " - " + conf_result;
Expand Down Expand Up @@ -2319,7 +2326,7 @@ var addBoardPosition = function (board, latitude, longitude, altitude, res){

logger.debug("--> Board "+available.message.label+" (" + board + ") exists!");

if (available.message.mobile == 1){
//if (available.message.mobile == 1){

db.addBoardPosition(board, latitude, longitude, altitude, function (data) {

Expand All @@ -2341,7 +2348,7 @@ var addBoardPosition = function (board, latitude, longitude, altitude, res){


});

/*
}else{
response.result = "WARNING";
Expand All @@ -2350,6 +2357,7 @@ var addBoardPosition = function (board, latitude, longitude, altitude, res){
res.status(200).send(response);
}
*/



Expand Down
2 changes: 1 addition & 1 deletion lib/management/mng_db.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ db_utils.prototype.regBoard = function (board, board_label, latitude, longitude,
}
else {
response.result = "WARNING";
response.message = "The board " + board_label + " ("+board+") already exists!";
response.message = "A board with ID '"+board+"' already exists!";
logger.warn("[SYSTEM] ----> " + response.message);
disconn(connection);
callback(response);
Expand Down

0 comments on commit a47193e

Please sign in to comment.