Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor generate and show fixes #2145

Merged
merged 1 commit into from
Mar 4, 2022

Conversation

dominikschulz
Copy link
Member

@dominikschulz dominikschulz commented Feb 26, 2022

Fixes #2140

Addresses a few minor issues found when trying to reproduce #2140.

RELEASE_NOTES=n/a

@dominikschulz dominikschulz added the ux User experience / User Interface related label Feb 26, 2022
@dominikschulz dominikschulz added this to the 1.14.0 milestone Feb 26, 2022
Fixes gopasspw#2140

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <[email protected]>
@@ -111,7 +111,7 @@ func keyAndLength(args argList) (string, string) {
func (s *Action) generateCopyOrPrint(ctx context.Context, c *cli.Context, name, key, password string) error {
entry := name
if key != "" {
entry += ":" + key
entry += " " + key
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have broken some test 😢
Why not keep the entry:key format?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it does not work. IIRC we did never support that format.

internal/action/generate.go Show resolved Hide resolved
@@ -220,7 +220,7 @@ func clamp(min, max, value int) int {
}

func (s *Action) generatePasswordForRule(ctx context.Context, c *cli.Context, length, name, domain string, rule pwrules.Rule) (string, error) {
out.Printf(ctx, "Using password rules for %s ...", domain)
out.Noticef(ctx, "Using password rules for %s ...", domain)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rephrase that to make it more obvious it's due to the domain name?
Something like :
"The domain %s appears to have specific password rules, using them."

@@ -231,6 +231,7 @@ func (s *Action) generatePasswordForRule(ctx context.Context, c *cli.Context, le
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we reject invalid lengths instead of just clamping them below?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. But either we make the implementation much more convoluted (loops etc.) or we abort the execution and possibly disrupt the user. Not sure either. But not clamping or checking them also sounds wrong.

@dominikschulz dominikschulz merged commit 757aa08 into gopasspw:master Mar 4, 2022
@dominikschulz dominikschulz deleted the fix/issue-2140 branch March 4, 2022 14:14
kpitt pushed a commit to kpitt/gopass that referenced this pull request Jul 21, 2022
Fixes gopasspw#2140

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ux User experience / User Interface related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it more obvious when we apply a rule on password generation
2 participants