Skip to content

Commit 8229e7a

Browse files
committed
Major refactor
1 parent 7f8268e commit 8229e7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3006
-1248
lines changed

auth/auth.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ import (
55
"time"
66

77
"github.com/golang-jwt/jwt/v5"
8+
"github.com/google/uuid"
89
)
910

1011
var jwtKey = []byte("supersecretkey")
1112

1213
type JWTClaim struct {
13-
Firstname string `json:"first_name"`
14-
Lastname string `json:"last_name"`
15-
Email string `json:"email"`
16-
Admin bool `json:"admin"`
17-
Verified bool `json:"verified"`
18-
UserID int `json:"id"`
14+
Firstname string `json:"first_name"`
15+
Lastname string `json:"last_name"`
16+
Email string `json:"email"`
17+
Admin bool `json:"admin"`
18+
Verified bool `json:"verified"`
19+
UserID uuid.UUID `json:"id"`
1920
jwt.RegisteredClaims
2021
}
2122

@@ -28,7 +29,7 @@ func SetPrivateKey(PrivateKey string) error {
2829
return nil
2930
}
3031

31-
func GenerateJWT(firstname string, lastname string, email string, userid int, admin bool, verified bool) (tokenString string, err error) {
32+
func GenerateJWT(firstname string, lastname string, email string, userid uuid.UUID, admin bool, verified bool) (tokenString string, err error) {
3233
expirationTime := time.Now().Add(1 * time.Hour * 24 * 7)
3334
claims := &JWTClaim{
3435
Firstname: firstname,

config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"strings"
1212
)
1313

14-
var poenskelisten_version_parameter = "v1.0.10"
14+
var poenskelisten_version_parameter = "v2.0.0"
1515
var config_path, _ = filepath.Abs("./files/config.json")
1616

1717
func GetConfig() (*models.ConfigStruct, error) {
@@ -62,7 +62,7 @@ func GetConfig() (*models.ConfigStruct, error) {
6262
anythingChanged = true
6363
}
6464

65-
if config.PoenskelistenVersion == "" {
65+
if config.PoenskelistenVersion == "" || config.PoenskelistenVersion != poenskelisten_version_parameter {
6666
// Set new value
6767
config.PoenskelistenVersion = poenskelisten_version_parameter
6868
anythingChanged = true
@@ -74,7 +74,7 @@ func GetConfig() (*models.ConfigStruct, error) {
7474
anythingChanged = true
7575
}
7676

77-
if config.DBType == "" || (strings.ToLower(config.DBType) != "mysql" && strings.ToLower(config.DBType) != "postgresql") {
77+
if config.DBType == "" || (strings.ToLower(config.DBType) != "mysql" && strings.ToLower(config.DBType) != "postgres" && strings.ToLower(config.DBType) != "sqlite") {
7878
// Set new value
7979
config.DBType = "mysql"
8080
anythingChanged = true

0 commit comments

Comments
 (0)