Improve rval for /check endpoint (now uses outgoing.User)
This commit is contained in:
parent
602f77c2f1
commit
64aee5a25b
@ -6,8 +6,10 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/crusttech/crust/auth/repository"
|
||||
"github.com/crusttech/crust/auth/types"
|
||||
"github.com/crusttech/crust/internal/auth"
|
||||
"github.com/crusttech/crust/internal/payload"
|
||||
"github.com/crusttech/crust/internal/payload/outgoing"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/titpetric/factory/resputil"
|
||||
|
||||
@ -18,7 +20,7 @@ import (
|
||||
type (
|
||||
checkResponse struct {
|
||||
JWT string `json:"jwt"`
|
||||
User *types.User `json:"user"`
|
||||
User *outgoing.User `json:"user"`
|
||||
}
|
||||
)
|
||||
|
||||
@ -48,7 +50,7 @@ func MountRoutes(oidcConfig *config.OIDC, jwtAuth jwtEncodeCookieSetter) func(ch
|
||||
if user, err := service.DefaultUser.With(ctx).FindByID(identity.Identity()); err == nil {
|
||||
resputil.JSON(w, checkResponse{
|
||||
JWT: c.Value,
|
||||
User: user,
|
||||
User: payload.User(user),
|
||||
})
|
||||
|
||||
return
|
||||
|
||||
@ -105,6 +105,7 @@ func User(user *auth.User) *outgoing.User {
|
||||
Name: user.Name,
|
||||
Handle: user.Handle,
|
||||
Username: user.Username,
|
||||
Email: user.Email,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ type (
|
||||
// Channel to part (nil) for ALL channels
|
||||
ID string `json:"ID"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
Username string `json:"username"`
|
||||
Handle string `json:"handle"`
|
||||
Connections uint `json:"connections"`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user