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:
105
text/message_verification.go
Normal file
105
text/message_verification.go
Normal file
@@ -0,0 +1,105 @@
|
||||
// Copyright © 2023 Ory Corp
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package text
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/ory/x/clock"
|
||||
)
|
||||
|
||||
func NewErrorValidationVerificationFlowExpired(c clock.Clock, expiredAt time.Time) *Message {
|
||||
return &Message{
|
||||
ID: ErrorValidationVerificationFlowExpired,
|
||||
Text: fmt.Sprintf("The verification 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 NewInfoSelfServiceVerificationSuccessful() *Message {
|
||||
return &Message{
|
||||
ID: InfoSelfServiceVerificationSuccessful,
|
||||
Type: Success,
|
||||
Text: "You successfully verified your email address.",
|
||||
}
|
||||
}
|
||||
|
||||
func NewInfoSelfServiceVerificationPhoneSuccessful() *Message {
|
||||
return &Message{
|
||||
ID: InfoSelfServiceVerificationPhoneSuccessful,
|
||||
Type: Success,
|
||||
Text: "You successfully verified your phone number.",
|
||||
}
|
||||
}
|
||||
|
||||
func NewVerificationEmailSent() *Message {
|
||||
return &Message{
|
||||
ID: InfoSelfServiceVerificationEmailSent,
|
||||
Type: Info,
|
||||
Text: "An email containing a verification link has been sent to the email address you provided. If you have not received an email, check the spelling of the address and make sure to use the address you registered with.",
|
||||
}
|
||||
}
|
||||
|
||||
func NewErrorValidationVerificationTokenInvalidOrAlreadyUsed() *Message {
|
||||
return &Message{
|
||||
ID: ErrorValidationVerificationTokenInvalidOrAlreadyUsed,
|
||||
Text: "The verification token is invalid or has already been used. Please retry the flow.",
|
||||
Type: Error,
|
||||
}
|
||||
}
|
||||
|
||||
func NewErrorValidationVerificationRetrySuccess() *Message {
|
||||
return &Message{
|
||||
ID: ErrorValidationVerificationRetrySuccess,
|
||||
Text: "The request was already completed successfully and can not be retried.",
|
||||
Type: Error,
|
||||
}
|
||||
}
|
||||
|
||||
func NewErrorValidationVerificationStateFailure() *Message {
|
||||
return &Message{
|
||||
ID: ErrorValidationVerificationStateFailure,
|
||||
Text: "The verification flow reached a failure state and must be retried.",
|
||||
Type: Error,
|
||||
}
|
||||
}
|
||||
|
||||
func NewErrorValidationVerificationCodeInvalidOrAlreadyUsed() *Message {
|
||||
return &Message{
|
||||
ID: ErrorValidationVerificationCodeInvalidOrAlreadyUsed,
|
||||
Text: "The verification code is invalid or has already been used. Please try again.",
|
||||
Type: Error,
|
||||
}
|
||||
}
|
||||
|
||||
func NewVerificationEmailWithCodeSent() *Message {
|
||||
return &Message{
|
||||
ID: InfoSelfServiceVerificationEmailWithCodeSent,
|
||||
Type: Info,
|
||||
Text: "An email containing a verification code has been sent to the email address you provided. If you have not received an email, check the spelling of the address and make sure to use the address you registered with.",
|
||||
}
|
||||
}
|
||||
|
||||
func NewVerificationPhoneWithCodeSent() *Message {
|
||||
return &Message{
|
||||
ID: InfoSelfServiceVerificationPhoneWithCodeSent,
|
||||
Type: Info,
|
||||
Text: "A text message containing a verification code has been sent to the phone number you provided. If you have not received a text message, check the spelling of the number and make sure to use the number you registered with.",
|
||||
}
|
||||
}
|
||||
|
||||
// VerificationCodeSentMessage returns the "code has been sent" message for the
|
||||
// channel the code was delivered over. SMS verifications get the phone wording;
|
||||
// every other channel falls back to the email wording.
|
||||
func VerificationCodeSentMessage(via string) *Message {
|
||||
if via == "sms" {
|
||||
return NewVerificationPhoneWithCodeSent()
|
||||
}
|
||||
return NewVerificationEmailWithCodeSent()
|
||||
}
|
||||
Reference in New Issue
Block a user