added database

This commit is contained in:
2021-10-20 16:11:18 +02:00
parent 8c6f59a6b4
commit 2268b518b1
7 changed files with 139 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/minio/minio-go/v7"
"git.kapelle.org/niklas/s3browser/internal/db"
helper "git.kapelle.org/niklas/s3browser/internal/helper"
"git.kapelle.org/niklas/s3browser/internal/loader"
types "git.kapelle.org/niklas/s3browser/internal/types"
@@ -203,8 +204,11 @@ func deleteDirectory(ctx context.Context, id types.ID) error {
//login Checks for valid username password combination. Returns singed jwt string
func login(ctx context.Context, username, password string) (types.LoginResult, error) {
// TODO: replace with propper user management
if username != "admin" && password != "hunter2" {
dbStore := ctx.Value("dbStore").(*db.DB)
succes, err := dbStore.CheckLogin(ctx, username, password)
if !succes {
return types.LoginResult{
Successful: false,
}, nil