aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-19 20:12:36 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-19 20:13:55 +0200
commitcd1fa849fb161d3bbc7c582aa2787315a1037db1 (patch)
tree970b883fed895ea6a217e4f7d50e3a3a3a02e7d5
parente359eaaebd7270476075ca9e08b7b53fb9e69f24 (diff)
downloadlens-cd1fa849fb161d3bbc7c582aa2787315a1037db1.tar.gz
lens-cd1fa849fb161d3bbc7c582aa2787315a1037db1.tar.bz2
lens-cd1fa849fb161d3bbc7c582aa2787315a1037db1.zip
fix: Fix path not storing properly
Also, initial user is now created as admin.
-rw-r--r--pkg/database/sql/user.go1
-rw-r--r--pkg/service/auth.go1
-rw-r--r--templates/register.html28
3 files changed, 2 insertions, 28 deletions
diff --git a/pkg/database/sql/user.go b/pkg/database/sql/user.go
index 11718be..15dbe72 100644
--- a/pkg/database/sql/user.go
+++ b/pkg/database/sql/user.go
@@ -140,6 +140,7 @@ func (self *UserRepository) Create(ctx context.Context, createUser *repository.C
user := &User{
Username: createUser.Username,
Name: createUser.Name,
+ Path: createUser.Path,
Password: string(createUser.Password),
}
diff --git a/pkg/service/auth.go b/pkg/service/auth.go
index 4358a8a..761c70b 100644
--- a/pkg/service/auth.go
+++ b/pkg/service/auth.go
@@ -69,6 +69,7 @@ func (c *AuthController) InitialRegister(ctx context.Context, username, password
_, err = c.userRepository.Create(ctx, &repository.CreateUser{
Username: string(username),
Password: hash,
+ IsAdmin: true,
Path: string(path),
})
diff --git a/templates/register.html b/templates/register.html
deleted file mode 100644
index b026d33..0000000
--- a/templates/register.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{{template "layout.html" .}}
-{{define "title"}} Initial Setup {{end}}
-{{define "content"}}
-<h1>Initial Setup</h1>
-<form action="/initial" method="post">
- <div class="field">
- <label class="label">Username</label>
- <div class="control">
- <input class="input" name="username" type="text">
- </div>
- </div>
- <div class="field">
- <label class="label">Password</label>
- <div class="control">
- <input class="input" name="password" type="password">
- </div>
- </div>
- <div class="field">
- <label class="label">Root folder</label>
- <div class="control">
- <input class="input" name="path" type="text">
- </div>
- </div>
- <div class="field">
- <input class="button is-pulled-right" value="Save" type="submit">
- </div>
-</form>
-{{end}}