Skip to content

Commit

Permalink
feat: add new messages
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Mar 7, 2022
1 parent 322d467 commit 09e6fd1
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 18 deletions.
9 changes: 8 additions & 1 deletion cmd/clidoc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func init() {
"NewInfoSelfServiceSettingsLookupSecretsLabel": text.NewInfoSelfServiceSettingsLookupSecretsLabel(),
"NewInfoSelfServiceSettingsUpdateLinkOIDC": text.NewInfoSelfServiceSettingsUpdateLinkOIDC("{provider}"),
"NewInfoSelfServiceSettingsUpdateUnlinkOIDC": text.NewInfoSelfServiceSettingsUpdateUnlinkOIDC("{provider}"),
"NewInfoSelfServiceRegisterWebAuthn": text.NewInfoSelfServiceRegisterWebAuthn(),
"NewInfoSelfServiceRegisterWebAuthn": text.NewInfoSelfServiceSettingsRegisterWebAuthn(),
"NewInfoSelfServiceRegisterWebAuthnDisplayName": text.NewInfoSelfServiceRegisterWebAuthnDisplayName(),
"NewInfoSelfServiceRemoveWebAuthn": text.NewInfoSelfServiceRemoveWebAuthn("{name}", aSecondAgo),
"NewErrorValidationVerificationFlowExpired": text.NewErrorValidationVerificationFlowExpired(-time.Second),
Expand Down Expand Up @@ -115,6 +115,13 @@ func init() {
"NewErrorValidationRecoveryRetrySuccess": text.NewErrorValidationRecoveryRetrySuccess(),
"NewErrorValidationRecoveryStateFailure": text.NewErrorValidationRecoveryStateFailure(),
"NewInfoNodeInputEmail": text.NewInfoNodeInputEmail(),
"NewInfoSelfServiceSettingsRegisterWebAuthn": text.NewInfoSelfServiceSettingsRegisterWebAuthn(),
"NewInfoLoginWebAuthnPasswordless": text.NewInfoLoginWebAuthnPasswordless(),
"NewInfoSelfServiceRegistrationRegisterWebAuthn": text.NewInfoSelfServiceRegistrationRegisterWebAuthn(),
"NewInfoLoginPasswordlessWebAuthn": text.NewInfoLoginPasswordlessWebAuthn(),
"NewInfoSelfServiceContinueLoginWebAuthn": text.NewInfoSelfServiceContinueLoginWebAuthn(),
"NewInfoSelfServiceLoginContinue": text.NewInfoSelfServiceLoginContinue(),
"NewErrorValidationSuchNoWebAuthnUser": text.NewErrorValidationSuchNoWebAuthnUser(),
}
}

Expand Down
35 changes: 20 additions & 15 deletions text/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ package text
type ID int

const (
InfoSelfServiceLoginRoot ID = 1010000 + iota // 1010000
InfoSelfServiceLogin // 1010001
InfoSelfServiceLoginWith // 1010002
InfoSelfServiceLoginReAuth // 1010003
InfoSelfServiceLoginMFA // 1010004
InfoSelfServiceLoginVerify // 1010005
InfoSelfServiceLoginTOTPLabel // 1010006
InfoLoginLookupLabel // 1010007
InfoSelfServiceLoginWebAuthn // 1010008
InfoLoginTOTP // 1010009
InfoLoginLookup // 1010010
InfoSelfServiceLoginRoot ID = 1010000 + iota // 1010000
InfoSelfServiceLogin // 1010001
InfoSelfServiceLoginWith // 1010002
InfoSelfServiceLoginReAuth // 1010003
InfoSelfServiceLoginMFA // 1010004
InfoSelfServiceLoginVerify // 1010005
InfoSelfServiceLoginTOTPLabel // 1010006
InfoLoginLookupLabel // 1010007
InfoSelfServiceLoginWebAuthn // 1010008
InfoLoginTOTP // 1010009
InfoLoginLookup // 1010010
InfoSelfServiceLoginContinueWebAuthn // 1010011
InfoSelfServiceLoginWebAuthnPasswordless // 1010012
InfoSelfServiceLoginContinue // 1010013
)

const (
Expand All @@ -28,10 +31,11 @@ const (
)

const (
InfoSelfServiceRegistrationRoot ID = 1040000 + iota // 1040000
InfoSelfServiceRegistration // 1040001
InfoSelfServiceRegistrationWith // 1040002
InfoRegistrationContinue // 1040003
InfoSelfServiceRegistrationRoot ID = 1040000 + iota // 1040000
InfoSelfServiceRegistration // 1040001
InfoSelfServiceRegistrationWith // 1040002
InfoSelfServiceRegistrationContinue // 1040003
InfoSelfServiceRegistrationRegisterWebAuthn // 1040004
)

const (
Expand Down Expand Up @@ -94,6 +98,7 @@ const (
ErrorValidationLookupAlreadyUsed
ErrorValidationNoWebAuthnDevice
ErrorValidationNoLookup
ErrorValidationSuchNoWebAuthnUser
)

const (
Expand Down
34 changes: 34 additions & 0 deletions text/message_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ func NewInfoLoginMFA() *Message {
}
}

func NewInfoLoginWebAuthnPasswordless() *Message {
return &Message{
ID: InfoSelfServiceLoginWebAuthnPasswordless,
Type: Info,
Text: "Prepare your WebAuthn device (e.g. security key, biometrics scanner, ...) and press continue.",
Context: context(nil),
}
}

func NewInfoLoginTOTPLabel() *Message {
return &Message{
ID: InfoSelfServiceLoginTOTPLabel,
Expand Down Expand Up @@ -50,6 +59,15 @@ func NewInfoLogin() *Message {
}
}

func NewInfoLoginPasswordlessWebAuthn() *Message {
return &Message{
ID: InfoSelfServiceLogin,
Text: "Sign in with security key",
Type: Info,
Context: context(map[string]interface{}{}),
}
}

func NewInfoLoginTOTP() *Message {
return &Message{
ID: InfoLoginTOTP,
Expand Down Expand Up @@ -146,3 +164,19 @@ func NewInfoSelfServiceLoginWebAuthn() *Message {
Type: Info,
}
}

func NewInfoSelfServiceContinueLoginWebAuthn() *Message {
return &Message{
ID: InfoSelfServiceLoginContinueWebAuthn,
Text: "Continue with security key",
Type: Info,
}
}

func NewInfoSelfServiceLoginContinue() *Message {
return &Message{
ID: InfoSelfServiceLoginContinue,
Text: "Continue",
Type: Info,
}
}
10 changes: 9 additions & 1 deletion text/message_registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewInfoRegistrationWith(provider string) *Message {

func NewInfoRegistrationContinue() *Message {
return &Message{
ID: InfoRegistrationContinue,
ID: InfoSelfServiceRegistrationContinue,
Text: "Continue",
Type: Info,
}
Expand All @@ -43,3 +43,11 @@ func NewErrorValidationRegistrationFlowExpired(ago time.Duration) *Message {
}),
}
}

func NewInfoSelfServiceRegistrationRegisterWebAuthn() *Message {
return &Message{
ID: InfoSelfServiceRegistrationRegisterWebAuthn,
Text: "Sign up with security key",
Type: Info,
}
}
2 changes: 1 addition & 1 deletion text/message_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func NewInfoSelfServiceSettingsUpdateUnlinkOIDC(provider string) *Message {
}
}

func NewInfoSelfServiceRegisterWebAuthn() *Message {
func NewInfoSelfServiceSettingsRegisterWebAuthn() *Message {
return &Message{
ID: InfoSelfServiceSettingsRegisterWebAuthn,
Text: "Add security key",
Expand Down
9 changes: 9 additions & 0 deletions text/message_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,12 @@ func NewErrorValidationNoWebAuthnDevice() *Message {
Context: context(nil),
}
}

func NewErrorValidationSuchNoWebAuthnUser() *Message {
return &Message{
ID: ErrorValidationSuchNoWebAuthnUser,
Text: "This account does not exist or has no security key set up.",
Type: Error,
Context: context(nil),
}
}

0 comments on commit 09e6fd1

Please sign in to comment.