From 3cf5bc8b7603b9958f31d173e4e268ef607a23fb Mon Sep 17 00:00:00 2001 From: Thomas Miceli Date: Thu, 4 May 2023 11:48:26 +0200 Subject: [PATCH] First account registering with OAuth is now admin --- internal/web/auth.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/web/auth.go b/internal/web/auth.go index 5e07826..9bc8d58 100644 --- a/internal/web/auth.go +++ b/internal/web/auth.go @@ -178,6 +178,12 @@ func oauthCallback(ctx echo.Context) error { return errorRes(500, "Cannot create user", err) } + if userDB.ID == 1 { + if err = userDB.SetAdmin(); err != nil { + return errorRes(500, "Cannot set user admin", err) + } + } + var resp *http.Response switch user.Provider { case "github":