Skip to content

fix: allow admin users to skip old password input#754

Open
adityashekhawat1999 wants to merge 2 commits intogoharbor:mainfrom
adityashekhawat1999:fix-password-admin
Open

fix: allow admin users to skip old password input#754
adityashekhawat1999 wants to merge 2 commits intogoharbor:mainfrom
adityashekhawat1999:fix-password-admin

Conversation

@adityashekhawat1999
Copy link
Contributor

Description

This updates the user password command to allow admin users to skip entering the old password.

Right now, the CLI always requires the old password but according to the API behaviour it’s optional for admins.

Type of Change

Please select the relevant type.

  • [ ✅] Bug fix
  • New feature
  • Refactor
  • Documentation update
  • Chore / maintenance

Changes

  • Added --admin flag to the password command
  • Updated validation to allow empty old password when --admin is used

Signed-off-by: Aditya Pratap Singh Shekhawat <adityashekhawat@Adityas-MacBook-Air.local>

:wq
:Wq
:wq
@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 7.81%. Comparing base (60ad0bd) to head (2aa9be1).
⚠️ Report is 118 commits behind head on main.

Files with missing lines Patch % Lines
pkg/views/password/change/view.go 0.00% 2 Missing ⚠️
cmd/harbor/root/password.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             main    #754      +/-   ##
=========================================
- Coverage   10.99%   7.81%   -3.18%     
=========================================
  Files         173     270      +97     
  Lines        8671   13171    +4500     
=========================================
+ Hits          953    1029      +76     
- Misses       7612   12029    +4417     
- Partials      106     113       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adityashekhawat1999
Copy link
Contributor Author

@NucleoFusion The cli would still send the old password field(empty for admin), i wanted to ask is that acceptable for the API or should the field be omitted entirely

@NucleoFusion
Copy link
Contributor

This should be fine, will have a better look.
Lint is failing btw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: Password change command only supports system admin

2 participants