Updated whitelist handling to save users when created. Also, added

default test user for habridge UI. Made change state to be validated
against whitelist.
This commit is contained in:
Admin
2017-03-13 16:37:42 -05:00
parent d15a1c58d0
commit fb24e9d1a3
8 changed files with 167 additions and 122 deletions

View File

@@ -57,6 +57,7 @@ app.config (function ($locationProvider, $routeProvider) {
app.run( function (bridgeService) {
bridgeService.loadBridgeSettings();
bridgeService.getHABridgeVersion();
bridgeService.getTestUser();
bridgeService.viewMapTypes();
});
@@ -160,6 +161,17 @@ app.service ('bridgeService', function ($http, $window, ngToast) {
);
};
this.getTestUser = function () {
return $http.get(this.state.systemsbase + "/habridge/testuser").then(
function (response) {
self.state.testuser = response.data.user;
},
function (error) {
self.displayWarn("Cannot get testuser: ", error);
}
);
};
this.aContainsB = function (a, b) {
return a.indexOf(b) >= 0;
}
@@ -774,7 +786,7 @@ app.service ('bridgeService', function ($http, $window, ngToast) {
this.testUrl = function (device, type, value) {
var msgDescription = "unknown";
var testUrl = this.state.huebase + "/test/lights/" + device.id + "/state";
var testUrl = this.state.huebase + "/" + this.state.testuser + "/lights/" + device.id + "/state";
var testBody = "{\"on\":";
if (type === "off") {
testBody = testBody + "false";