Skip to content

Commit c654a5c

Browse files
committed
Fixed GOKAPI_GUEST_UPLOAD_BY_DEFAULT not being honoured for OAuth and Header Auth #378
1 parent 9a4b289 commit c654a5c

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

internal/webserver/authentication/Authentication.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/forceu/gokapi/internal/models"
2020
"github.com/forceu/gokapi/internal/webserver/authentication/csrftoken"
2121
"github.com/forceu/gokapi/internal/webserver/authentication/sessionmanager"
22+
"github.com/forceu/gokapi/internal/webserver/authentication/users"
2223
)
2324

2425
type userNameContext string
@@ -245,15 +246,8 @@ func getOrCreateUser(username string) (models.User, bool) {
245246
if authSettings.OnlyRegisteredUsers {
246247
return models.User{}, false
247248
}
248-
user = models.User{
249-
Name: username,
250-
UserLevel: models.UserLevelUser,
251-
}
252-
database.SaveUser(user, true)
253-
user, ok = database.GetUserByName(username)
254-
if !ok {
255-
panic("unable to read new user")
256-
}
249+
//TODO check error, already done in branch betterErrors
250+
user, _ = users.Create(username)
257251
}
258252
return user, true
259253
}

0 commit comments

Comments
 (0)