fixes double encryption of integration secrets
This commit is contained in:
20
db/main.go
20
db/main.go
@@ -74,7 +74,9 @@ func setupEventHandlers(app *pocketbase.PocketBase, client meilisearch.ServiceMa
|
|||||||
|
|
||||||
app.OnRecordsListRequest("integrations").BindFunc(listIntegrationHandler())
|
app.OnRecordsListRequest("integrations").BindFunc(listIntegrationHandler())
|
||||||
app.OnRecordCreateRequest("integrations").BindFunc(createIntegrationHandler())
|
app.OnRecordCreateRequest("integrations").BindFunc(createIntegrationHandler())
|
||||||
|
app.OnRecordAfterCreateSuccess("integrations").BindFunc(createUpdateIntegrationSuccessHandler())
|
||||||
app.OnRecordUpdateRequest("integrations").BindFunc(updateIntegrationHandler())
|
app.OnRecordUpdateRequest("integrations").BindFunc(updateIntegrationHandler())
|
||||||
|
app.OnRecordAfterUpdateSuccess("integrations").BindFunc(createUpdateIntegrationSuccessHandler())
|
||||||
|
|
||||||
app.OnRecordRequestEmailChangeRequest("users").BindFunc(changeUserEmailHandler())
|
app.OnRecordRequestEmailChangeRequest("users").BindFunc(changeUserEmailHandler())
|
||||||
app.OnServe().BindFunc(onBeforeServeHandler(client))
|
app.OnServe().BindFunc(onBeforeServeHandler(client))
|
||||||
@@ -421,11 +423,13 @@ func createIntegrationHandler() func(e *core.RecordRequestEvent) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := e.Next(); err != nil {
|
return e.Next()
|
||||||
return err
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = censorIntegrationSecrets(e.Record)
|
func createUpdateIntegrationSuccessHandler() func(e *core.RecordEvent) error {
|
||||||
|
return func(e *core.RecordEvent) error {
|
||||||
|
err := censorIntegrationSecrets(e.Record)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -440,14 +444,6 @@ func updateIntegrationHandler() func(e *core.RecordRequestEvent) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := e.Next(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = censorIntegrationSecrets(e.Record)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return e.Next()
|
return e.Next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user