Forráskód Böngészése

refactor(webui): ensure auth failure causes a visual logout

Also add some debug stmts.
Mustafa Arici 7 éve
szülő
commit
1222a9f15f

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
bindata/bindata.go


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
template/bundle.js


+ 2 - 4
webui/ovpm/app/api.js

@@ -1,15 +1,13 @@
-//export const baseURL = "http://192.168.14.200:9091/v1"//ev
-//export const baseURL = "http://172.16.16.149:9091/v1" //ofislaptop
-//export const baseURL = "http://172.16.16.79:9091/v1"  //ofis desktop
 export var baseURL = window.location.protocol + "//" + window.location.host + "/api/v1"
 
 if (process.env.NODE_ENV !== 'production') {
-    baseURL = "http://172.16.16.79:9091/api/v1"
+    baseURL = "http://192.168.14.181:8080/api/v1" // local pc external ip
 }
 
 export const endpoints = {
     authenticate: {
         path: "/auth/authenticate",
+
         method: "POST",
     },
     authStatus: {

+ 6 - 0
webui/ovpm/app/components/Dashboard/AdminDashboard/index.jsx

@@ -169,9 +169,11 @@ export default class AdminDashboard extends React.Component {
     handleAuthFailure(error) {
         console.log("auth failure", error)
         ClearAuthToken()
+        this.setState({"logout": true})
     }
 
     handleCreateNewUser(e) {
+        console.log("create new user")
         this.setState({modal: CREATINGNEWUSER})
     }
 
@@ -183,6 +185,8 @@ export default class AdminDashboard extends React.Component {
         for (let i in this.state.users) {
             if (this.state.users[i].username === username) {
                 this.setState({modal: EDITINGUSER, editedUser: this.state.users[i]})
+                console.log(i)
+                console.log("updating user:", this.state.users[i].username)
                 return
             }
         }
@@ -205,6 +209,7 @@ export default class AdminDashboard extends React.Component {
         userObj.host_id = user.ipAllocationMethod === "static" ? dot2num(user.staticIP) : 0
         userObj.static_pref = user.ipAllocationMethod === "static" ? "STATIC" : "NOSTATIC"
 
+        console.log("creating new user:", user.username)
         this.api.call("userCreate", userObj, true, this.handleCreateUserSuccess.bind(this), this.handleCreateUserFailure.bind(this))
         this.setState({modal: ""})
     }
@@ -238,6 +243,7 @@ export default class AdminDashboard extends React.Component {
         updatedUser.admin_pref = user.isAdmin ? "ADMIN" : "NOADMIN"
         updatedUser.host_id = user.ipAllocationMethod === "static" ? dot2num(user.staticIP) : 0
         updatedUser.static_pref = user.ipAllocationMethod === "static" ? "STATIC" : "NOSTATIC"
+        console.log("updating user:", updatedUser.username)
         this.api.call("userUpdate", updatedUser, true, this.handleUpdateUserSuccess.bind(this), this.handleUpdateUserFailure.bind(this))
 
         this.setState({modal: ""})

+ 1 - 1
webui/ovpm/app/utils/auth.js

@@ -17,7 +17,7 @@ export function ClearAuthToken() {
 }
 
 export function IsAuthenticated() {
-    if (GetAuthToken()) {
+    if (GetAuthToken() != "") {
         return true
     }
     return false

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
webui/ovpm/public/bundle.js


Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott