diff --git a/AssassinGo b/AssassinGo index 80acc4f..84733e6 100755 Binary files a/AssassinGo and b/AssassinGo differ diff --git a/web/controller.go b/web/controller.go index 6d99f51..503ef81 100644 --- a/web/controller.go +++ b/web/controller.go @@ -37,6 +37,7 @@ func signin(ctx *sweetygo.Context) error { claims["exp"] = time.Now().Add(time.Hour * 36).Unix() t, _ := token.SignedString([]byte(config.SecretKey)) ctx.SetCookie("SG_Token", t) + ctx.JSON(200, 1, "success", map[string]string{"SG_Token": t}) a := assassin.New() s := assassin.NewSiblings() @@ -44,7 +45,7 @@ func signin(ctx *sweetygo.Context) error { daddy.Sibling[username] = s logger.Green.Println(username, "Has Signed In") - return ctx.JSON(200, 1, "success", map[string]string{"SG_Token": t}) + return nil } return ctx.JSON(200, 0, "Username or Password Error.", nil) } diff --git a/web/router.go b/web/router.go index 8de0692..15faf83 100644 --- a/web/router.go +++ b/web/router.go @@ -10,7 +10,7 @@ import ( func SetMiddlewares(app *sweetygo.SweetyGo) { // cors app.USE(func(ctx *sweetygo.Context) error { - ctx.Resp.Header().Set("Access-Control-Allow-Origin", "http://localhost:8080") + ctx.Resp.Header().Set("Access-Control-Allow-Origin", "http://localhost:8000") ctx.Resp.Header().Set("Access-Control-Allow-Credentials", "true") ctx.Next() return nil diff --git a/web/run.go b/web/run.go index 04b6cf8..70329c6 100644 --- a/web/run.go +++ b/web/run.go @@ -16,6 +16,7 @@ func init() { // Run Web GUI. func Run() { app := sweetygo.New() + app.SetTemplates("/web/templates", nil) SetMiddlewares(app) SetRouter(app) app.Run(":8000")