Add create from email
This commit is contained in:
@@ -164,7 +164,7 @@ func (a *Auth) AddRoutes(e *echo.Echo) []ersteller_lib.Route {
|
||||
userId, err := a.userRepo.GetUserId(data.Email)
|
||||
if err != nil {
|
||||
ersteller_lib.LogError("Failed to get user id: %v", err)
|
||||
userId, err = a.userRepo.Create(data.Email)
|
||||
userId, err = a.userRepo.CreateFromEmail(data.Email)
|
||||
if err != nil {
|
||||
ersteller_lib.LogError("Failed to create user: %v", err)
|
||||
return err
|
||||
|
||||
@@ -114,7 +114,7 @@ func RunKeycloakAuth(e *echo.Echo, environment KeycloakEnv, cookieStore *session
|
||||
}
|
||||
|
||||
func createUser(gothUser goth.User, repo UserRepository) (int, error) {
|
||||
return repo.Create(gothUser.Email)
|
||||
return repo.CreateFromEmail(gothUser.Email)
|
||||
}
|
||||
|
||||
func saveEmailToSessionStore(c echo.Context, sessionStore *sessions.CookieStore, email string, userId int, environment KeycloakEnv) error {
|
||||
|
||||
@@ -2,5 +2,5 @@ package authentication
|
||||
|
||||
type UserRepository interface {
|
||||
GetUserId(email string) (int, error)
|
||||
Create(email string) (int, error)
|
||||
CreateFromEmail(email string) (int, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user