snapshot of https://github.com/ory/kratos.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
CI / Run tests and lints (push) Failing after 29s
CI / Build CLI docs (push) Has been skipped
CI / Run Playwright end-to-end tests (mysql) (push) Failing after 3s
CI / Run Playwright end-to-end tests (postgres) (push) Failing after 2s
CI / Run Playwright end-to-end tests (sqlite) (push) Failing after 3s
CodeQL / Analyze (go) (push) Failing after 4s
CodeQL / Analyze (javascript) (push) Failing after 3s
Docker Image Scanners / scanners (push) Failing after 4s
Synchronize Issue Labels / Synchronize Issue Labels (push) Has been skipped
CI / Run end-to-end tests (postgres) (push) Failing after 19s
CI / Run end-to-end tests (sqlite) (push) Failing after 2s
CI / Run Playwright end-to-end tests (cockroach) (push) Failing after 2s
CI / Draft newsletter (push) Has been skipped
CI / Generate release (push) Has been skipped
CI / Pending approval Slack notification (push) Has been skipped
CI / Send newsletter (push) Has been skipped
Some checks failed
CI / Run tests and lints (push) Failing after 29s
CI / Build CLI docs (push) Has been skipped
CI / Run Playwright end-to-end tests (mysql) (push) Failing after 3s
CI / Run Playwright end-to-end tests (postgres) (push) Failing after 2s
CI / Run Playwright end-to-end tests (sqlite) (push) Failing after 3s
CodeQL / Analyze (go) (push) Failing after 4s
CodeQL / Analyze (javascript) (push) Failing after 3s
Docker Image Scanners / scanners (push) Failing after 4s
Synchronize Issue Labels / Synchronize Issue Labels (push) Has been skipped
CI / Run end-to-end tests (postgres) (push) Failing after 19s
CI / Run end-to-end tests (sqlite) (push) Failing after 2s
CI / Run Playwright end-to-end tests (cockroach) (push) Failing after 2s
CI / Draft newsletter (push) Has been skipped
CI / Generate release (push) Has been skipped
CI / Pending approval Slack notification (push) Has been skipped
CI / Send newsletter (push) Has been skipped
This commit is contained in:
85
driver/registry_default_registration.go
Normal file
85
driver/registry_default_registration.go
Normal file
@@ -0,0 +1,85 @@
|
||||
// Copyright © 2023 Ory Corp
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package driver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"slices"
|
||||
|
||||
"github.com/ory/kratos/driver/config"
|
||||
"github.com/ory/kratos/identity"
|
||||
"github.com/ory/kratos/selfservice/flow/registration"
|
||||
)
|
||||
|
||||
func (m *RegistryDefault) PostRegistrationPrePersistHooks(ctx context.Context, credentialsType identity.CredentialsType) ([]registration.PostHookPrePersistExecutor, error) {
|
||||
hooks, err := getHooks[registration.PostHookPrePersistExecutor](m, string(credentialsType), m.Config().SelfServiceFlowRegistrationAfterHooks(ctx, string(credentialsType)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return hooks, nil
|
||||
}
|
||||
|
||||
func (m *RegistryDefault) PostRegistrationPostPersistHooks(ctx context.Context, credentialsType identity.CredentialsType) ([]registration.PostHookPostPersistExecutor, error) {
|
||||
hooks, err := getHooks[registration.PostHookPostPersistExecutor](m, string(credentialsType), m.Config().SelfServiceFlowRegistrationAfterHooks(ctx, string(credentialsType)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(hooks) == 0 {
|
||||
// since we don't want merging hooks defined in a specific strategy and
|
||||
// global hooks are added only if no strategy specific hooks are defined
|
||||
hooks, err = getHooks[registration.PostHookPostPersistExecutor](m, config.HookGlobal, m.Config().SelfServiceFlowRegistrationAfterHooks(ctx, config.HookGlobal))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// WARNING - If you remove this, no verification emails / sms will be sent post-registration.
|
||||
if m.Config().SelfServiceFlowVerificationEnabled(ctx) {
|
||||
hooks = slices.Insert(hooks, 0, registration.PostHookPostPersistExecutor(m.HookVerifier()))
|
||||
}
|
||||
|
||||
return hooks, nil
|
||||
}
|
||||
|
||||
func (m *RegistryDefault) PreRegistrationHooks(ctx context.Context) ([]registration.PreHookExecutor, error) {
|
||||
return getHooks[registration.PreHookExecutor](m, "", m.Config().SelfServiceFlowRegistrationBeforeHooks(ctx))
|
||||
}
|
||||
|
||||
func (m *RegistryDefault) RegistrationExecutor() *registration.HookExecutor {
|
||||
if m.selfserviceRegistrationExecutor == nil {
|
||||
m.selfserviceRegistrationExecutor = registration.NewHookExecutor(m)
|
||||
}
|
||||
return m.selfserviceRegistrationExecutor
|
||||
}
|
||||
|
||||
func (m *RegistryDefault) RegistrationHookExecutor() *registration.HookExecutor {
|
||||
if m.selfserviceRegistrationExecutor == nil {
|
||||
m.selfserviceRegistrationExecutor = registration.NewHookExecutor(m)
|
||||
}
|
||||
return m.selfserviceRegistrationExecutor
|
||||
}
|
||||
|
||||
func (m *RegistryDefault) RegistrationErrorHandler() *registration.ErrorHandler {
|
||||
if m.seflserviceRegistrationErrorHandler == nil {
|
||||
m.seflserviceRegistrationErrorHandler = registration.NewErrorHandler(m)
|
||||
}
|
||||
return m.seflserviceRegistrationErrorHandler
|
||||
}
|
||||
|
||||
func (m *RegistryDefault) RegistrationHandler() *registration.Handler {
|
||||
if m.selfserviceRegistrationHandler == nil {
|
||||
m.selfserviceRegistrationHandler = registration.NewHandler(m)
|
||||
}
|
||||
|
||||
return m.selfserviceRegistrationHandler
|
||||
}
|
||||
|
||||
func (m *RegistryDefault) RegistrationFlowErrorHandler() *registration.ErrorHandler {
|
||||
if m.selfserviceRegistrationRequestErrorHandler == nil {
|
||||
m.selfserviceRegistrationRequestErrorHandler = registration.NewErrorHandler(m)
|
||||
}
|
||||
|
||||
return m.selfserviceRegistrationRequestErrorHandler
|
||||
}
|
||||
Reference in New Issue
Block a user