Skip to content

Commit a47193e

Browse files
committed
v2.2.0: fix some bugs
1 parent f3cc008 commit a47193e

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

lib/management/mng_auth.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ var computeCredentials = function (b_pw, b_pub_key, callback) {
600600
response.message = "credentials";
601601
response.result = "SUCCESS";
602602
response.hash_pw = pw_result.message;
603+
response.gen_pw = gen_pw;
603604
callback(response);
604605

605606
}

lib/management/mng_board.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@ board_utils = function (session, rest) {
522522
var hash_b_pw = credentials.hash_pw;
523523
var b_pub_key = credentials.pub_key;
524524

525+
console.log(credentials);
526+
525527
db.regBoard(board_id, board_label, latitude, longitude, altitude, net_enabled, sensorslist, layout_id, description,
526528
extra, project_id, user_id, mobile, position_refr_time, notify, notify_rate, notify_retry, b_pub_key, hash_b_pw,
527529

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

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

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

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

795-
session.call('s4t.' + board + '.board.setBoardPosition', [position]).then(
800+
console.log("position @ " + position.timestamp);
801+
802+
session_wamp.call('s4t.' + board + '.board.setBoardPosition', [position]).then(
796803

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

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

2322-
if (available.message.mobile == 1){
2329+
//if (available.message.mobile == 1){
23232330

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

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

23422349

23432350
});
2344-
2351+
/*
23452352
}else{
23462353
23472354
response.result = "WARNING";
@@ -2350,6 +2357,7 @@ var addBoardPosition = function (board, latitude, longitude, altitude, res){
23502357
res.status(200).send(response);
23512358
23522359
}
2360+
*/
23532361

23542362

23552363

lib/management/mng_db.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ db_utils.prototype.regBoard = function (board, board_label, latitude, longitude,
571571
}
572572
else {
573573
response.result = "WARNING";
574-
response.message = "The board " + board_label + " ("+board+") already exists!";
574+
response.message = "A board with ID '"+board+"' already exists!";
575575
logger.warn("[SYSTEM] ----> " + response.message);
576576
disconn(connection);
577577
callback(response);

0 commit comments

Comments
 (0)