Skip to content

Commit

Permalink
feat: improve labels for totp and lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Oct 19, 2021
1 parent 3269028 commit b92e00e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion selfservice/strategy/lookup/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ func NewConfirmLookupNode() *node.Node {
}

func NewLookupNode(secrets []string) *node.Node {
return node.NewTextField(node.LookupCodes, text.NewInfoSelfServiceSettingsLookupSecrets(secrets), node.LookupGroup)
return node.NewTextField(node.LookupCodes, text.NewInfoSelfServiceSettingsLookupSecrets(secrets), node.LookupGroup).WithMetaLabel(text.NewInfoSelfServiceSettingsLookupSecretsLabel())
}
4 changes: 3 additions & 1 deletion selfservice/strategy/totp/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ func NewTOTPImageQRNode(key *otp.Key) (*node.Node, error) {
}

func NewTOTPSourceURLNode(key *otp.Key) *node.Node {
return node.NewTextField(node.TOTPSecretKey, text.NewInfoSelfServiceSettingsTOTPSecret(key.Secret()), node.TOTPGroup)
return node.NewTextField(node.TOTPSecretKey,
text.NewInfoSelfServiceSettingsTOTPSecret(key.Secret()), node.TOTPGroup).
WithMetaLabel(text.NewInfoSelfServiceSettingsTOTPSecretLabel())
}

func NewUnlinkTOTPNode() *node.Node {
Expand Down
19 changes: 17 additions & 2 deletions text/message_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,20 @@ func NewInfoSelfServiceSettingsTOTPQRCode() *Message {
func NewInfoSelfServiceSettingsTOTPSecret(secret string) *Message {
return &Message{
ID: InfoSelfServiceSettingsTOTPSecret,
Text: fmt.Sprintf("Your authenticator app secret: %s", secret),
Text: secret,
Type: Info,
Context: context(map[string]interface{}{
"secret": secret,
}),
}
}
func NewInfoSelfServiceSettingsTOTPSecretLabel() *Message {
return &Message{
ID: InfoSelfServiceSettingsTOTPSecret,
Text: "This is your authenticator app secret. Use it if you can not scan the QR code.",
Type: Info,
}
}

func NewInfoSelfServiceSettingsUpdateSuccess() *Message {
return &Message{
Expand Down Expand Up @@ -98,14 +105,22 @@ func NewInfoSelfServiceSettingsLookupConfirm() *Message {
func NewInfoSelfServiceSettingsLookupSecrets(secrets []string) *Message {
return &Message{
ID: InfoSelfServiceSettingsLookupSecrets,
Text: fmt.Sprintf("Please keep your new back up recovery codes in a safe place. They are: %s", strings.Join(secrets, " ")),
Text: fmt.Sprintf("%s", strings.Join(secrets, " ")),
Type: Info,
Context: context(map[string]interface{}{
"secrets": secrets,
}),
}
}

func NewInfoSelfServiceSettingsLookupSecretsLabel() *Message {
return &Message{
ID: InfoSelfServiceSettingsLookupSecrets,
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,
Expand Down

0 comments on commit b92e00e

Please sign in to comment.