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
116 lines
2.8 KiB
Go
116 lines
2.8 KiB
Go
// Copyright © 2023 Ory Corp
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package text
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/ory/x/clock"
|
|
)
|
|
|
|
func NewInfoRegistration() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceRegistration,
|
|
Text: "Sign up",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoRegistrationWith(provider string, providerID string) *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceRegistrationWith,
|
|
Text: fmt.Sprintf("Sign up with %s", provider),
|
|
Type: Info,
|
|
Context: context(map[string]any{
|
|
"provider": provider,
|
|
"provider_id": providerID,
|
|
}),
|
|
}
|
|
}
|
|
|
|
func NewInfoRegistrationContinue() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceRegistrationContinue,
|
|
Text: "Continue",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoRegistrationBack() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceRegistrationBack,
|
|
Text: "Back",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceChooseCredentials() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceRegistrationChooseCredentials,
|
|
Text: "Please choose a credential to authenticate yourself with.",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewErrorValidationRegistrationFlowExpired(c clock.Clock, expiredAt time.Time) *Message {
|
|
return &Message{
|
|
ID: ErrorValidationRegistrationFlowExpired,
|
|
Text: fmt.Sprintf("The registration 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 NewInfoSelfServiceRegistrationRegisterWebAuthn() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceRegistrationRegisterWebAuthn,
|
|
Text: "Sign up with security key",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceRegistrationRegisterPasskey() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceRegistrationRegisterPasskey,
|
|
Text: "Sign up with passkey",
|
|
Type: Info,
|
|
}
|
|
}
|
|
|
|
func NewRegistrationEmailWithCodeSent() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceRegistrationEmailWithCodeSent,
|
|
Type: Info,
|
|
Text: "A code has been sent to the address(es) you provided. If you have not received a message, check the spelling of the address and retry the registration.",
|
|
}
|
|
}
|
|
|
|
func NewErrorValidationRegistrationCodeInvalidOrAlreadyUsed() *Message {
|
|
return &Message{
|
|
ID: ErrorValidationRegistrationCodeInvalidOrAlreadyUsed,
|
|
Text: "The registration code is invalid or has already been used. Please try again.",
|
|
Type: Error,
|
|
}
|
|
}
|
|
|
|
func NewErrorValidationRegistrationRetrySuccessful() *Message {
|
|
return &Message{
|
|
ID: ErrorValidateionRegistrationRetrySuccess,
|
|
Type: Error,
|
|
Text: "The request was already completed successfully and can not be retried.",
|
|
}
|
|
}
|
|
|
|
func NewInfoSelfServiceRegistrationRegisterCode() *Message {
|
|
return &Message{
|
|
ID: InfoSelfServiceRegistrationRegisterCode,
|
|
Text: "Send sign up code",
|
|
Type: Info,
|
|
}
|
|
}
|