Skip to content

Commit

Permalink
make not.reg. without token possible in token endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
konrad2002 committed Nov 19, 2024
1 parent e8eb6c9 commit 977e5b2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions controller/notification_user_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,13 @@ func registerNotificationUser(c *gin.Context) {

claims, err1 := getClaimsFromAuthHeader(c)

if err1 != nil {
c.IndentedJSON(http.StatusNotFound, gin.H{"message": err1.Error()})
return
}

user, err := service.GetUserByKeycloakId(claims.Sub)
if err != nil {
c.IndentedJSON(http.StatusNotFound, gin.H{"message": err.Error()})
return
var user model.User
if err1 == nil {
user, err1 = service.GetUserByKeycloakId(claims.Sub)
if err1 != nil {
c.IndentedJSON(http.StatusNotFound, gin.H{"message": err1.Error()})
return
}
}

r, err := service.RegisterNotificationUser(request.Token, request.Device, &user)
Expand Down

0 comments on commit 977e5b2

Please sign in to comment.