feat(cli): add interactive passwd command#1410
Merged
LinkinStars merged 2 commits intoapache:devfrom Oct 28, 2025
Merged
Conversation
passwd command
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new interactive CLI command answer passwd for securely resetting user passwords and refactors path-related configuration into a centralized internal/base/path package. It also fixes a bug where the timestamp parameter was missing when updating user status in tests.
Key Changes:
- New
passwdcommand with secure password prompting and optional random password generation - Centralized path configuration by moving constants and helpers from
internal/clitointernal/base/path - Fixed missing timestamp parameter in user status update test calls
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/command.go | Adds resetPasswordCmd definition with flags and wires it into the root command |
| cmd/main.go | Updates import to use new path package |
| internal/cli/reset_password.go | New file implementing the password reset command with interactive prompts and validation |
| internal/cli/install.go | Removes path-related code moved to path package and updates references |
| internal/cli/install_check.go | Updates to use path package instead of cli |
| internal/base/path/path.go | New centralized package for path configuration constants and helpers |
| internal/base/conf/conf.go | Updates import to use new path package |
| internal/install/install_main.go | Updates import to use new path package |
| internal/install/install_controller.go | Updates to reference path package for path constants |
| internal/repo/repo_test/user_backyard_repo_test.go | Fixes test calls to include missing timestamp parameter |
| pkg/checker/reserved_username.go | Updates import to use new path package |
| go.mod | Adds golang.org/x/term dependency for secure password input |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
LinkinStars
approved these changes
Oct 28, 2025
Member
LinkinStars
left a comment
There was a problem hiding this comment.
Thank you for your contribution. I have tested the functionality and it works without issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a secure, interactive CLI to reset a user’s password per #1400. Also includes a minor fix to include the time parameter when updating user status.
What’s changed
answer passwd(aliases:password,reset-password)golang.org/x/term)-e/--email,-p/--password(not recommended due to shell history)cmd/command.gointernal/base/pathUsage
answer passwd -C ./answer-data -e user@example.com # will securely prompt for passwordOpen question
Observed that
authSvc.RemoveUserAllTokens(ctx, userInfo.ID)returns success but existing web sessions remain active. Same behavior when invoked from the user center password update flow. Is there an additional session/cache invalidation step required, or is this a bug in the session/token layer?Linked issue
resetPasswordoption to command-line tool #1400