Add secret-safe copy and reveal UX coverage
This commit is contained in:
@@ -86,7 +86,6 @@ type ui struct {
|
||||
copyUser widget.Clickable
|
||||
copyPass widget.Clickable
|
||||
copyURL widget.Clickable
|
||||
openURL widget.Clickable
|
||||
lockVault widget.Clickable
|
||||
unlockVault widget.Clickable
|
||||
createVault widget.Clickable
|
||||
@@ -135,6 +134,7 @@ type ui struct {
|
||||
eyeIcon *widget.Icon
|
||||
eyeOffIcon *widget.Icon
|
||||
copyIcon *widget.Icon
|
||||
clipboardWriter clipboard.Writer
|
||||
loadingMessage string
|
||||
statusMessage string
|
||||
errorMessage string
|
||||
@@ -975,10 +975,7 @@ func (u *ui) detailPanel(gtx layout.Context) layout.Dimensions {
|
||||
layout.Rigid(u.entryEditorPanel),
|
||||
)
|
||||
}
|
||||
password := strings.Repeat("•", max(8, len(item.Password)))
|
||||
if u.showPassword {
|
||||
password = item.Password
|
||||
}
|
||||
password := u.detailPasswordValue()
|
||||
titleSize := unit.Sp(26)
|
||||
titlePad := unit.Dp(10)
|
||||
sectionGap := unit.Dp(8)
|
||||
@@ -1016,7 +1013,7 @@ func (u *ui) detailPanel(gtx layout.Context) layout.Dimensions {
|
||||
}),
|
||||
layout.Rigid(layout.Spacer{Height: unit.Dp(8)}.Layout),
|
||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
||||
return tonedButton(gtx, u.theme, &u.openURL, "Open URL")
|
||||
return tonedButton(gtx, u.theme, &u.copyURL, "Copy URL")
|
||||
}),
|
||||
)
|
||||
}
|
||||
@@ -1032,7 +1029,7 @@ func (u *ui) detailPanel(gtx layout.Context) layout.Dimensions {
|
||||
}),
|
||||
layout.Rigid(layout.Spacer{Width: unit.Dp(8)}.Layout),
|
||||
layout.Rigid(func(gtx layout.Context) layout.Dimensions {
|
||||
btn := material.Button(u.theme, &u.openURL, "Open URL")
|
||||
btn := material.Button(u.theme, &u.copyURL, "Copy URL")
|
||||
return btn.Layout(gtx)
|
||||
}),
|
||||
)
|
||||
@@ -1201,6 +1198,17 @@ func (u *ui) passwordLine(label, value string) layout.Widget {
|
||||
}
|
||||
}
|
||||
|
||||
func (u *ui) detailPasswordValue() string {
|
||||
item, ok := u.selectedEntry()
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
if u.showPassword {
|
||||
return item.Password
|
||||
}
|
||||
return strings.Repeat("•", max(8, len(item.Password)))
|
||||
}
|
||||
|
||||
func card(gtx layout.Context, w layout.Widget) layout.Dimensions {
|
||||
return layout.Background{}.Layout(gtx, fill(panelColor), func(gtx layout.Context) layout.Dimensions {
|
||||
return layout.UniformInset(unit.Dp(16)).Layout(gtx, w)
|
||||
|
||||
Reference in New Issue
Block a user