feat (user): add sanitize to hide password for log
This commit is contained in:
No files matched your search
@@ -75,3 +75,9 @@ func ToResponseList(users []User) []ResponseDto {
|
|||||||
}
|
}
|
||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c CreateDto) Sanitize() CreateDto {
|
||||||
|
sanitized := c
|
||||||
|
sanitized.Password = "[REDACTED]"
|
||||||
|
return sanitized
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start log
|
// Start log
|
||||||
pl.SetLogInfo(&event, input, "started", "create")
|
pl.SetLogInfo(&event, input.Sanitize(), "started", "create")
|
||||||
|
|
||||||
err := dg.I.Transaction(func(tx *gorm.DB) error {
|
err := dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
mwRunner := newMiddlewareRunner(&event, tx)
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
|
|||||||
Reference in New Issue
Block a user