Removed debugging fmts, made localStorage clear on a login
This commit is contained in:
parent
2210185f33
commit
6bc7e887e0
4
main.go
4
main.go
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
|
@ -357,14 +356,12 @@ func Main(information library.ServiceInitializationInformation) *chi.Mux {
|
|||
sub, username, err := getUsername(commentData.JwtToken, oauthHostName, publicKey)
|
||||
if err != nil {
|
||||
renderJSON(400, w, map[string]interface{}{"error": "Invalid JWT token"}, information)
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
subBytes, err := uuid.MustParse(sub).MarshalBinary()
|
||||
if err != nil {
|
||||
renderJSON(500, w, map[string]interface{}{"error": "Internal server error", "code": "10"}, information)
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -385,7 +382,6 @@ func Main(information library.ServiceInitializationInformation) *chi.Mux {
|
|||
_, err = conn.DB.Exec("INSERT INTO comments (id, rfcId, rfcYear, content, creator, creatorName, created) VALUES ($1, $2, $3, $4, $5, $6, $7)", commentIdBytes, commentData.RfcId, commentData.RfcYear, commentData.Content, subBytes, username, time.Now().Unix())
|
||||
if err != nil {
|
||||
renderJSON(500, w, map[string]interface{}{"error": "Internal server error", "code": "13"}, information)
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -41,11 +41,9 @@ func randomChars(length int) (string, error) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
// Redirect to rfc if already logged in
|
||||
// Clear local storage
|
||||
localStorage := js.Global().Get("localStorage")
|
||||
if !localStorage.Call("getItem", "SECRET-token").IsNull() {
|
||||
js.Global().Get("window").Get("location").Call("replace", "/rfc")
|
||||
}
|
||||
localStorage.Call("clear")
|
||||
|
||||
statusBox := js.Global().Get("document").Call("getElementById", "statusBox")
|
||||
tryAgain := js.Global().Get("document").Call("getElementById", "tryAgain")
|
||||
|
|
Loading…
Reference in New Issue