diff --git a/identity/.snapshots/TestToNode.json b/identity/.snapshots/TestToNode.json index 2d9c6b3e9b2b..43295a2f2fa7 100644 --- a/identity/.snapshots/TestToNode.json +++ b/identity/.snapshots/TestToNode.json @@ -13,7 +13,8 @@ "text": "Secret was used at 2021-08-17 11:32:38 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:38Z" + "used_at": "2021-08-17T11:32:38Z", + "used_at_unix": 1629199958 } }, { @@ -37,7 +38,8 @@ "text": "Secret was used at 2021-08-17 11:32:48 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:48Z" + "used_at": "2021-08-17T11:32:48Z", + "used_at_unix": 1629199968 } } ] diff --git a/schema/errors.go b/schema/errors.go index 8ca948d86327..aec9def17f03 100644 --- a/schema/errors.go +++ b/schema/errors.go @@ -6,9 +6,6 @@ package schema import ( "fmt" - "golang.org/x/text/cases" - "golang.org/x/text/language" - "github.com/pkg/errors" "github.com/ory/jsonschema/v3" @@ -145,11 +142,6 @@ type DuplicateCredentialsHinter interface { func NewDuplicateCredentialsError(err error) error { if hinter := DuplicateCredentialsHinter(nil); errors.As(err, &hinter) && hinter.HasHints() { - oidcProviders := make([]string, 0, len(hinter.AvailableOIDCProviders())) - for _, provider := range hinter.AvailableOIDCProviders() { - oidcProviders = append(oidcProviders, cases.Title(language.English).String(provider)) - } - return errors.WithStack(&ValidationError{ ValidationError: &jsonschema.ValidationError{ Message: `an account with the same identifier (email, phone, username, ...) exists already`, diff --git a/selfservice/flow/recovery/.snapshots/TestHandleError-flow=api-case=fails_if_active_strategy_is_disabled.json b/selfservice/flow/recovery/.snapshots/TestHandleError-flow=api-case=fails_if_active_strategy_is_disabled.json index 4bb7e689fd5a..d6c78d8b8358 100644 --- a/selfservice/flow/recovery/.snapshots/TestHandleError-flow=api-case=fails_if_active_strategy_is_disabled.json +++ b/selfservice/flow/recovery/.snapshots/TestHandleError-flow=api-case=fails_if_active_strategy_is_disabled.json @@ -62,7 +62,9 @@ "id": 4000001, "text": "The active recovery strategy code is not enabled. Please enable it in the configuration.", "type": "error", - "context": {} + "context": { + "reason": "The active recovery strategy code is not enabled. Please enable it in the configuration." + } } ] }, diff --git a/selfservice/flow/recovery/.snapshots/TestHandleError-flow=spa-case=fails_if_active_strategy_is_disabled.json b/selfservice/flow/recovery/.snapshots/TestHandleError-flow=spa-case=fails_if_active_strategy_is_disabled.json index 7e6c9fd7f953..7a17de3f9374 100644 --- a/selfservice/flow/recovery/.snapshots/TestHandleError-flow=spa-case=fails_if_active_strategy_is_disabled.json +++ b/selfservice/flow/recovery/.snapshots/TestHandleError-flow=spa-case=fails_if_active_strategy_is_disabled.json @@ -62,7 +62,9 @@ "id": 4000001, "text": "The active recovery strategy code is not enabled. Please enable it in the configuration.", "type": "error", - "context": {} + "context": { + "reason": "The active recovery strategy code is not enabled. Please enable it in the configuration." + } } ] }, diff --git a/selfservice/strategy/lookup/.snapshots/TestCompleteLogin-case=lookup_payload_is_set_when_identity_has_lookup.json b/selfservice/strategy/lookup/.snapshots/TestCompleteLogin-case=lookup_payload_is_set_when_identity_has_lookup.json index b732a1221b9f..4de9e6d84166 100644 --- a/selfservice/strategy/lookup/.snapshots/TestCompleteLogin-case=lookup_payload_is_set_when_identity_has_lookup.json +++ b/selfservice/strategy/lookup/.snapshots/TestCompleteLogin-case=lookup_payload_is_set_when_identity_has_lookup.json @@ -25,7 +25,6 @@ "messages": [], "meta": { "label": { - "context": {}, "id": 1010007, "text": "Backup recovery code", "type": "info" @@ -45,7 +44,6 @@ "messages": [], "meta": { "label": { - "context": {}, "id": 1010010, "text": "Use backup recovery code", "type": "info" diff --git a/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-case=should_pass_without_csrf_if_API_flow.json b/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-case=should_pass_without_csrf_if_API_flow.json index 2a63830646d9..8b4fe733e80f 100644 --- a/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-case=should_pass_without_csrf_if_API_flow.json +++ b/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-case=should_pass_without_csrf_if_API_flow.json @@ -35,7 +35,8 @@ "text": "Secret was used at 2021-08-17 11:32:39 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:39Z" + "used_at": "2021-08-17T11:32:39Z", + "used_at_unix": 1629199959 } }, { @@ -59,7 +60,8 @@ "text": "Secret was used at 2021-08-17 11:32:42 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:42Z" + "used_at": "2021-08-17T11:32:42Z", + "used_at_unix": 1629199962 } }, { @@ -83,7 +85,8 @@ "text": "Secret was used at 2021-08-17 11:32:45 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:45Z" + "used_at": "2021-08-17T11:32:45Z", + "used_at_unix": 1629199965 } }, { @@ -107,7 +110,8 @@ "text": "Secret was used at 2021-08-17 11:32:48 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:48Z" + "used_at": "2021-08-17T11:32:48Z", + "used_at_unix": 1629199968 } }, { diff --git a/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=api.json b/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=api.json index 2a63830646d9..8b4fe733e80f 100644 --- a/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=api.json +++ b/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=api.json @@ -35,7 +35,8 @@ "text": "Secret was used at 2021-08-17 11:32:39 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:39Z" + "used_at": "2021-08-17T11:32:39Z", + "used_at_unix": 1629199959 } }, { @@ -59,7 +60,8 @@ "text": "Secret was used at 2021-08-17 11:32:42 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:42Z" + "used_at": "2021-08-17T11:32:42Z", + "used_at_unix": 1629199962 } }, { @@ -83,7 +85,8 @@ "text": "Secret was used at 2021-08-17 11:32:45 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:45Z" + "used_at": "2021-08-17T11:32:45Z", + "used_at_unix": 1629199965 } }, { @@ -107,7 +110,8 @@ "text": "Secret was used at 2021-08-17 11:32:48 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:48Z" + "used_at": "2021-08-17T11:32:48Z", + "used_at_unix": 1629199968 } }, { diff --git a/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=browser.json b/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=browser.json index 2a63830646d9..8b4fe733e80f 100644 --- a/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=browser.json +++ b/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=browser.json @@ -35,7 +35,8 @@ "text": "Secret was used at 2021-08-17 11:32:39 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:39Z" + "used_at": "2021-08-17T11:32:39Z", + "used_at_unix": 1629199959 } }, { @@ -59,7 +60,8 @@ "text": "Secret was used at 2021-08-17 11:32:42 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:42Z" + "used_at": "2021-08-17T11:32:42Z", + "used_at_unix": 1629199962 } }, { @@ -83,7 +85,8 @@ "text": "Secret was used at 2021-08-17 11:32:45 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:45Z" + "used_at": "2021-08-17T11:32:45Z", + "used_at_unix": 1629199965 } }, { @@ -107,7 +110,8 @@ "text": "Secret was used at 2021-08-17 11:32:48 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:48Z" + "used_at": "2021-08-17T11:32:48Z", + "used_at_unix": 1629199968 } }, { diff --git a/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=spa.json b/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=spa.json index 2a63830646d9..8b4fe733e80f 100644 --- a/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=spa.json +++ b/selfservice/strategy/lookup/.snapshots/TestCompleteSettings-type=regenerate_but_no_confirmation-type=spa.json @@ -35,7 +35,8 @@ "text": "Secret was used at 2021-08-17 11:32:39 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:39Z" + "used_at": "2021-08-17T11:32:39Z", + "used_at_unix": 1629199959 } }, { @@ -59,7 +60,8 @@ "text": "Secret was used at 2021-08-17 11:32:42 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:42Z" + "used_at": "2021-08-17T11:32:42Z", + "used_at_unix": 1629199962 } }, { @@ -83,7 +85,8 @@ "text": "Secret was used at 2021-08-17 11:32:45 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:45Z" + "used_at": "2021-08-17T11:32:45Z", + "used_at_unix": 1629199965 } }, { @@ -107,7 +110,8 @@ "text": "Secret was used at 2021-08-17 11:32:48 +0000 UTC", "type": "info", "context": { - "used_at": "2021-08-17T11:32:48Z" + "used_at": "2021-08-17T11:32:48Z", + "used_at_unix": 1629199968 } }, { diff --git a/selfservice/strategy/totp/.snapshots/TestCompleteLogin-case=totp_payload_is_set_when_identity_has_totp.json b/selfservice/strategy/totp/.snapshots/TestCompleteLogin-case=totp_payload_is_set_when_identity_has_totp.json index ff40c45ad144..afae3de49f05 100644 --- a/selfservice/strategy/totp/.snapshots/TestCompleteLogin-case=totp_payload_is_set_when_identity_has_totp.json +++ b/selfservice/strategy/totp/.snapshots/TestCompleteLogin-case=totp_payload_is_set_when_identity_has_totp.json @@ -25,7 +25,6 @@ "messages": [], "meta": { "label": { - "context": {}, "id": 1010006, "text": "Authentication code", "type": "info" @@ -45,7 +44,6 @@ "messages": [], "meta": { "label": { - "context": {}, "id": 1010009, "text": "Use Authenticator", "type": "info" diff --git a/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=mfa-case=can_not_use_security_key_for_passwordless_in_mfa_flow.json b/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=mfa-case=can_not_use_security_key_for_passwordless_in_mfa_flow.json index 560d85d68d4c..4ca8cb394931 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=mfa-case=can_not_use_security_key_for_passwordless_in_mfa_flow.json +++ b/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=mfa-case=can_not_use_security_key_for_passwordless_in_mfa_flow.json @@ -2,7 +2,6 @@ { "id": 4000008, "text": "The provided authentication code is invalid, please try again.", - "type": "error", - "context": {} + "type": "error" } ] diff --git a/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=should_fail_if_webauthn_login_is_invalid-type=browser.json b/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=should_fail_if_webauthn_login_is_invalid-type=browser.json index 815e99cb456b..2815954bab6f 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=should_fail_if_webauthn_login_is_invalid-type=browser.json +++ b/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=should_fail_if_webauthn_login_is_invalid-type=browser.json @@ -76,8 +76,7 @@ "messages": [ { "text": "Prepare your WebAuthn device (e.g. security key, biometrics scanner, ...) and press continue.", - "type": "info", - "context": {} + "type": "info" } ] }, diff --git a/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=should_fail_if_webauthn_login_is_invalid-type=spa.json b/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=should_fail_if_webauthn_login_is_invalid-type=spa.json index 815e99cb456b..2815954bab6f 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=should_fail_if_webauthn_login_is_invalid-type=spa.json +++ b/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=should_fail_if_webauthn_login_is_invalid-type=spa.json @@ -76,8 +76,7 @@ "messages": [ { "text": "Prepare your WebAuthn device (e.g. security key, biometrics scanner, ...) and press continue.", - "type": "info", - "context": {} + "type": "info" } ] }, diff --git a/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=webauthn_button_exists.json b/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=webauthn_button_exists.json index 2b73efff9f55..0c402bfe2612 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=webauthn_button_exists.json +++ b/selfservice/strategy/webauthn/.snapshots/TestCompleteLogin-flow=passwordless-case=webauthn_button_exists.json @@ -44,7 +44,6 @@ "messages": [], "meta": { "label": { - "context": {}, "id": 1010001, "text": "Sign in with security key", "type": "info" diff --git a/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=a_device_is_shown_which_can_be_unlinked.json b/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=a_device_is_shown_which_can_be_unlinked.json index 43a740b43790..d27075b6063d 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=a_device_is_shown_which_can_be_unlinked.json +++ b/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=a_device_is_shown_which_can_be_unlinked.json @@ -26,6 +26,7 @@ "label": { "context": { "added_at": "0001-01-01T00:00:00Z", + "added_at_unix": -62135596800, "display_name": "bar" }, "id": 1050018, @@ -49,6 +50,7 @@ "label": { "context": { "added_at": "0001-01-01T00:00:00Z", + "added_at_unix": -62135596800, "display_name": "foo" }, "id": 1050018, diff --git a/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=fails_to_remove_security_key_if_it_is_passwordless_and_the_last_credential_available-type=browser-response.json b/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=fails_to_remove_security_key_if_it_is_passwordless_and_the_last_credential_available-type=browser-response.json index c3147ce1a714..ab452afa7ea9 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=fails_to_remove_security_key_if_it_is_passwordless_and_the_last_credential_available-type=browser-response.json +++ b/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=fails_to_remove_security_key_if_it_is_passwordless_and_the_last_credential_available-type=browser-response.json @@ -12,7 +12,9 @@ "id": 4000001, "text": "unable to remove this security key because it would lock you out of your account", "type": "error", - "context": {} + "context": { + "reason": "unable to remove this security key because it would lock you out of your account" + } } ], "meta": {} diff --git a/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=fails_to_remove_security_key_if_it_is_passwordless_and_the_last_credential_available-type=spa-response.json b/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=fails_to_remove_security_key_if_it_is_passwordless_and_the_last_credential_available-type=spa-response.json index c3147ce1a714..ab452afa7ea9 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=fails_to_remove_security_key_if_it_is_passwordless_and_the_last_credential_available-type=spa-response.json +++ b/selfservice/strategy/webauthn/.snapshots/TestCompleteSettings-case=fails_to_remove_security_key_if_it_is_passwordless_and_the_last_credential_available-type=spa-response.json @@ -12,7 +12,9 @@ "id": 4000001, "text": "unable to remove this security key because it would lock you out of your account", "type": "error", - "context": {} + "context": { + "reason": "unable to remove this security key because it would lock you out of your account" + } } ], "meta": {} diff --git a/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_does_not_exist_when_passwordless_is_disabled-browser.json b/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_does_not_exist_when_passwordless_is_disabled-browser.json index 3d16974da7c4..cd42a6256ce0 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_does_not_exist_when_passwordless_is_disabled-browser.json +++ b/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_does_not_exist_when_passwordless_is_disabled-browser.json @@ -70,7 +70,6 @@ "messages": [], "meta": { "label": { - "context": {}, "id": 1040001, "text": "Sign up", "type": "info" diff --git a/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_does_not_exist_when_passwordless_is_disabled-spa.json b/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_does_not_exist_when_passwordless_is_disabled-spa.json index 3d16974da7c4..cd42a6256ce0 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_does_not_exist_when_passwordless_is_disabled-spa.json +++ b/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_does_not_exist_when_passwordless_is_disabled-spa.json @@ -70,7 +70,6 @@ "messages": [], "meta": { "label": { - "context": {}, "id": 1040001, "text": "Sign up", "type": "info" diff --git a/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_exists-browser.json b/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_exists-browser.json index 09b1f9ed6449..f95c0ade36aa 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_exists-browser.json +++ b/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_exists-browser.json @@ -136,7 +136,6 @@ "messages": [], "meta": { "label": { - "context": {}, "id": 1040001, "text": "Sign up", "type": "info" diff --git a/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_exists-spa.json b/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_exists-spa.json index 09b1f9ed6449..f95c0ade36aa 100644 --- a/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_exists-spa.json +++ b/selfservice/strategy/webauthn/.snapshots/TestRegistration-case=webauthn_button_exists-spa.json @@ -136,7 +136,6 @@ "messages": [], "meta": { "label": { - "context": {}, "id": 1040001, "text": "Sign up", "type": "info" diff --git a/text/message_validation.go b/text/message_validation.go index 419fde60a4dc..d94e9e4fc8db 100644 --- a/text/message_validation.go +++ b/text/message_validation.go @@ -7,6 +7,9 @@ import ( "fmt" "strings" + "golang.org/x/text/cases" + "golang.org/x/text/language" + "golang.org/x/exp/maps" ) @@ -269,6 +272,11 @@ func NewErrorValidationDuplicateCredentialsWithHints(availableCredentialTypes [] if identifier == "" { identifier = "an email, phone, or username" } + oidcProviders := make([]string, 0, len(availableOIDCProviders)) + for _, provider := range availableOIDCProviders { + oidcProviders = append(oidcProviders, cases.Title(language.English).String(provider)) + } + reason := fmt.Sprintf("You tried signing in with %s which is already in use by another account.", identifier) if len(availableCredentialTypes) > 0 { humanReadable := make(map[string]struct{}, len(availableCredentialTypes))