sermoni

"Service monitor" / cronjob status service
Log | Files | Refs

commit 30ff6b1729422747c3ffff607519f18f8c463c8b
parent 5e06ffde58df78dfe605c3200bd67e8c96e1b0c3
Author: Vetle Haflan <vetle@haflan.dev>
Date:   Mon, 13 Apr 2020 00:24:56 +0200

Minor fix and mod

Diffstat:
Minternal/http/auth.go | 3+--
Mui/src/App.vue | 12++++++++----
2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/internal/http/auth.go b/internal/http/auth.go @@ -8,7 +8,6 @@ import ( "strings" "time" - "github.com/gorilla/securecookie" "github.com/gorilla/sessions" ) @@ -24,7 +23,7 @@ func initHandler(w http.ResponseWriter, r *http.Request) { val := session.Values["csrftoken"] token, ok := val.(string) if !ok { - token = string(securecookie.GenerateRandomKey(32)) + token = temporary32CharRandomString() session.Values["csrftoken"] = token session.Save(r, w) // TODO: Error handling, as always } diff --git a/ui/src/App.vue b/ui/src/App.vue @@ -9,7 +9,7 @@ </div> </header> <main> - <component :is="page" @login="login"/> + <component v-if="page" :is="page" @login="login"/> </main> </div> </template> @@ -25,8 +25,8 @@ components: {Login, Eye, Events, Services}, data() { return { - page: Login, - serviceView: false + page: null, + serviceView: false, }; }, methods: { @@ -48,7 +48,11 @@ api.init( successData => { console.log(successData); - api.login() + if (successData.authenticated) { + this.page = Events; + } else { + this.page = Login; + } }, errorData => { console.log(errorData);