diff --git a/apis/auth_endpoints.go b/apis/auth_endpoints.go
index 56e8e33..0ffb4c3 100644
--- a/apis/auth_endpoints.go
+++ b/apis/auth_endpoints.go
@@ -44,7 +44,7 @@ func authLogin(c *gin.Context) {
return
}
- c.SetCookie("token", jwt, 3600, "/", "", true, true)
+ c.SetCookie("CLORTHO_AUTH", jwt, 3600, "/", "", true, true)
c.JSON(200, gin.H{"valid": true})
}
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 1b1d864..9735432 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -14,7 +14,7 @@ func main() {
log.Fatal("Could not initialize connection to the DB", err)
}
- adminPass, err := users.InitAdminUser(nil)
+ adminPass, err := users.InitAdminUser()
if err != nil {
log.Println(err)
} else {
diff --git a/frontend/src/layouts/default.vue b/frontend/src/layouts/default.vue
index d8083a8..61b7c04 100644
--- a/frontend/src/layouts/default.vue
+++ b/frontend/src/layouts/default.vue
@@ -35,26 +35,25 @@
-
+
diff --git a/frontend/src/pages/signin.vue b/frontend/src/pages/signin.vue
new file mode 100644
index 0000000..abfa605
--- /dev/null
+++ b/frontend/src/pages/signin.vue
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+ Login
+
+
+
+
+
+
+
+
+
+
+
+ Login
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/typed-router.d.ts b/frontend/src/typed-router.d.ts
index 331ee51..16e50ee 100644
--- a/frontend/src/typed-router.d.ts
+++ b/frontend/src/typed-router.d.ts
@@ -19,5 +19,6 @@ declare module 'vue-router/auto-routes' {
*/
export interface RouteNamedMap {
'/': RouteRecordInfo<'/', '/', Record, Record>,
+ '/signin': RouteRecordInfo<'/signin', '/signin', Record, Record>,
}
}
diff --git a/frontend/vite.config.mts b/frontend/vite.config.mts
index 9c92f25..499ece3 100644
--- a/frontend/vite.config.mts
+++ b/frontend/vite.config.mts
@@ -70,6 +70,9 @@ export default defineConfig({
},
server: {
port: 3000,
+ proxy: {
+ '/private': 'http://localhost:8080',
+ }
},
css: {
preprocessorOptions: {
diff --git a/users/users.go b/users/users.go
index 91a5944..19c7f00 100644
--- a/users/users.go
+++ b/users/users.go
@@ -2,6 +2,7 @@ package users
import (
"clortho/db"
+ "clortho/utils"
"crypto/rand"
"errors"
"fmt"
@@ -78,7 +79,12 @@ func InitAdminUser() (*string, error) {
return nil, errors.New("Admin user already exists")
}
- pass, _ := GenerateSecurePassword(32)
+ var pass string
+ if utils.IsDev() {
+ pass = "admin"
+ } else {
+ pass, _ = GenerateSecurePassword(32)
+ }
hash, _ := HashPassword(pass)
admin := db.User{Username: username, DisplayName: &username, Admin: true, PasswordHash: &hash}
result := db.Connection.Create(&admin)
diff --git a/utils/utils.go b/utils/utils.go
index cab13ab..a493a3d 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -1,5 +1,15 @@
package utils
+import "os"
+
func Ptr(s string) *string {
return &s
}
+
+func IsDev() bool {
+ strDev := os.Getenv("CLORTHO_DEV")
+ if strDev == "true" {
+ return true
+ }
+ return false
+}