From 09e6fd16bb6be0ff3ee209bbfe69e967546f70da Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Wed, 2 Mar 2022 09:47:30 +0100 Subject: [PATCH] feat: add new messages --- cmd/clidoc/main.go | 9 ++++++++- text/id.go | 35 ++++++++++++++++++++--------------- text/message_login.go | 34 ++++++++++++++++++++++++++++++++++ text/message_registration.go | 10 +++++++++- text/message_settings.go | 2 +- text/message_validation.go | 9 +++++++++ 6 files changed, 81 insertions(+), 18 deletions(-) diff --git a/cmd/clidoc/main.go b/cmd/clidoc/main.go index 9724f8b33e36..943d2ff9f89e 100644 --- a/cmd/clidoc/main.go +++ b/cmd/clidoc/main.go @@ -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), @@ -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(), } } diff --git a/text/id.go b/text/id.go index 3347b4749fef..08c95e23dbcc 100644 --- a/text/id.go +++ b/text/id.go @@ -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 ( @@ -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 ( @@ -94,6 +98,7 @@ const ( ErrorValidationLookupAlreadyUsed ErrorValidationNoWebAuthnDevice ErrorValidationNoLookup + ErrorValidationSuchNoWebAuthnUser ) const ( diff --git a/text/message_login.go b/text/message_login.go index 1beab9956331..2543ab78edfc 100644 --- a/text/message_login.go +++ b/text/message_login.go @@ -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, @@ -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, @@ -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, + } +} diff --git a/text/message_registration.go b/text/message_registration.go index f5069ba5f316..56c06ebcaea7 100644 --- a/text/message_registration.go +++ b/text/message_registration.go @@ -27,7 +27,7 @@ func NewInfoRegistrationWith(provider string) *Message { func NewInfoRegistrationContinue() *Message { return &Message{ - ID: InfoRegistrationContinue, + ID: InfoSelfServiceRegistrationContinue, Text: "Continue", Type: Info, } @@ -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, + } +} diff --git a/text/message_settings.go b/text/message_settings.go index 5cbd01a092a3..aecb5ec39dfc 100644 --- a/text/message_settings.go +++ b/text/message_settings.go @@ -153,7 +153,7 @@ func NewInfoSelfServiceSettingsUpdateUnlinkOIDC(provider string) *Message { } } -func NewInfoSelfServiceRegisterWebAuthn() *Message { +func NewInfoSelfServiceSettingsRegisterWebAuthn() *Message { return &Message{ ID: InfoSelfServiceSettingsRegisterWebAuthn, Text: "Add security key", diff --git a/text/message_validation.go b/text/message_validation.go index b98abc8ec366..da048273911c 100644 --- a/text/message_validation.go +++ b/text/message_validation.go @@ -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), + } +}