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
228 lines
5.5 KiB
Go
228 lines
5.5 KiB
Go
// Copyright © 2023 Ory Corp
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package text
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"time"
|
|
|
|
"github.com/ory/x/clock"
|
|
)
|
|
|
|
func NewErrorValidationSettingsFlowExpired(c clock.Clock, expiredAt time.Time) *Message {
|
|
return &Message{
|
|
ID: ErrorValidationSettingsFlowExpired,
|
|
Text: fmt.Sprintf("The settings flow expired %.2f minutes ago, please try again.", c.Now().Sub(expiredAt).Minutes()),
|
|
Type: Error,
|
|
Context: context(map[string]any{
|
|
"expired_at": expiredAt,
|
|
"expired_at_unix": expiredAt.Unix(),
|
|
}),
|
|
}
|
|
}
|
|
|
|
func NewErrorValidationSettingsTooManyAddressChanges() *Message {
|
|
return &Message{
|
|
ID: ErrorValidationSettingsTooManyAddressChanges,
|
|
Text: "You can only change one address at a time. Please update each address separately.",
|
|
Type: Error,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsTOTPQRCode() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsTOTPQRCode,
|
|
Text: "Authenticator app QR code",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsTOTPSecret(secret string) *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsTOTPSecret,
|
|
Text: secret,
|
|
Type: Info,
|
|
Context: context(map[string]any{
|
|
"secret": secret,
|
|
}),
|
|
}
|
|
}
|
|
func NewInfoSelfServiceSettingsTOTPSecretLabel() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsTOTPSecretLabel,
|
|
Text: "This is your authenticator app secret. Use it if you can not scan the QR code.",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsUpdateSuccess() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsUpdateSuccess,
|
|
Text: "Your changes have been saved!",
|
|
Type: Success,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsUpdateUnlinkTOTP() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsUpdateUnlinkTOTP,
|
|
Text: "Unlink TOTP Authenticator App",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsRevealLookup() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsRevealLookup,
|
|
Text: "Reveal backup recovery codes",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsRegenerateLookup() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsRegenerateLookup,
|
|
Text: "Generate new backup recovery codes",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsDisableLookup() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsDisableLookup,
|
|
Text: "Disable this method",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsLookupConfirm() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsLookupConfirm,
|
|
Text: "Confirm backup recovery codes",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsLookupSecretList(secrets []string, raw any) *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsLookupSecretList,
|
|
Text: strings.Join(secrets, ", "),
|
|
Type: Info,
|
|
Context: context(map[string]any{
|
|
"secrets": raw,
|
|
}),
|
|
}
|
|
}
|
|
func NewInfoSelfServiceSettingsLookupSecret(secret string) *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsLookupSecret,
|
|
Text: secret,
|
|
Type: Info,
|
|
Context: context(map[string]any{
|
|
"secret": secret,
|
|
}),
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsLookupSecretUsed(usedAt time.Time) *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsLookupSecretUsed,
|
|
Text: fmt.Sprintf("Secret was used at %s", usedAt),
|
|
Type: Info,
|
|
Context: context(map[string]any{
|
|
"used_at": usedAt,
|
|
"used_at_unix": usedAt.Unix(),
|
|
}),
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsLookupSecretsLabel() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsLookupSecretLabel,
|
|
Text: "These are your back up recovery codes. Please keep them in a safe place!",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsUpdateLinkOIDC(provider string) *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsUpdateLinkOidc,
|
|
Text: fmt.Sprintf("Link %s", provider),
|
|
Type: Info,
|
|
Context: context(map[string]any{
|
|
"provider": provider,
|
|
}),
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsUpdateUnlinkOIDC(provider string) *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsUpdateUnlinkOidc,
|
|
Text: fmt.Sprintf("Unlink %s", provider),
|
|
Type: Info,
|
|
Context: context(map[string]any{
|
|
"provider": provider,
|
|
}),
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsRegisterWebAuthn() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsRegisterWebAuthn,
|
|
Text: "Add security key",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsRegisterPasskey() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsRegisterPasskey,
|
|
Text: "Add passkey",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceRegisterWebAuthnDisplayName() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsRegisterWebAuthnDisplayName,
|
|
Text: "Name of the security key",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceRemoveWebAuthn(name string, createdAt time.Time) *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsRemoveWebAuthn,
|
|
Text: fmt.Sprintf("Remove security key \"%s\"", name),
|
|
Type: Info,
|
|
Context: context(map[string]any{
|
|
"display_name": name,
|
|
"added_at": createdAt,
|
|
"added_at_unix": createdAt.Unix(),
|
|
}),
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceRemovePasskey(name string, createdAt time.Time) *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsRemovePasskey,
|
|
Text: fmt.Sprintf("Remove passkey \"%s\"", name),
|
|
Type: Info,
|
|
Context: context(map[string]any{
|
|
"display_name": name,
|
|
"added_at": createdAt,
|
|
"added_at_unix": createdAt.Unix(),
|
|
}),
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceSettingsManagedByOrganization() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceSettingsManagedByOrganization,
|
|
Text: "Your account is managed by your organization. To change these settings, contact your organization administrator.",
|
|
Type: Info,
|
|
}
|
|
}
|