Skip to content

Conversation

@sudo87
Copy link
Collaborator

@sudo87 sudo87 commented Dec 18, 2025

Description

This PR introduces enforcement of password changes for users upon login after an admin-initiated reset.

API changes:

  1. A boolean param "passwordChangeRequired" is introduced in UpdateUserCmd
  2. It is applicable only for normal user role, admin or domain admin are excluded
  3. Row with name="PasswordChangeRequired" gets added into user_details table
  4. passwordchangerequired: true in loginresponse for when login is invoked
  5. UserAccount gets a new field passwordchangerequired
  6. ListApis response contains limited APIs for user, who are required to change password
    [ "login", "logout", "updateUser", "listUsers", "listApis" ]

UI

  1. New route /user/forceChangePassword
  2. Guard check for passwordchangerequired and no apis request other than listUser
  3. ForceChangePassword component

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

Screen.Recording.2025-12-18.at.4.11.45.PM.mov

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

❌ Patch coverage is 40.00000% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.51%. Comparing base (f417c6b) to head (1fb241b).
⚠️ Report is 44 commits behind head on main.

Files with missing lines Patch % Lines
server/src/main/java/com/cloud/api/ApiServer.java 0.00% 7 Missing ⚠️
...ache/cloudstack/api/response/LoginCmdResponse.java 0.00% 6 Missing ⚠️
...c/main/java/com/cloud/user/AccountManagerImpl.java 50.00% 1 Missing and 5 partials ⚠️
...oudstack/api/command/admin/user/UpdateUserCmd.java 0.00% 3 Missing ⚠️
.../cloudstack/discovery/ApiDiscoveryServiceImpl.java 90.90% 0 Missing and 1 partial ⚠️
.../cloudstack/user/UserPasswordResetManagerImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #12294      +/-   ##
============================================
+ Coverage     17.46%   17.51%   +0.05%     
- Complexity    15516    15595      +79     
============================================
  Files          5913     5915       +2     
  Lines        529385   529981     +596     
  Branches      64679    64737      +58     
============================================
+ Hits          92448    92821     +373     
- Misses       426518   426700     +182     
- Partials      10419    10460      +41     
Flag Coverage Δ
uitests 3.57% <ø> (-0.02%) ⬇️
unittests 18.58% <40.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sudo87
Copy link
Collaborator Author

sudo87 commented Dec 18, 2025

@blueorangutan package

@blueorangutan
Copy link

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@vishesh92 vishesh92 requested a review from Copilot December 18, 2025 11:35
@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 16086

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a feature to enforce password changes for normal users after an admin-initiated password reset. When an admin resets a user's password, they can require the user to change it upon next login. The user is then redirected to a forced password change page and has limited API access until the password is updated.

Key Changes:

  • Added passwordChangeRequired boolean parameter to the updateUser API command, allowing admins to flag users for mandatory password change
  • Introduced a new UI route /user/forceChangePassword with a dedicated component that restricts users to password change until completed
  • Implemented navigation guards and API restrictions to limit users to essential APIs (login, logout, updateUser, listUsers, listApis) when password change is required

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
ui/src/views/iam/ForceChangePassword.vue New component for forced password change page with form validation and success state
ui/src/views/iam/ChangeUserPassword.vue Added checkbox for admins to require password change on next login
ui/src/store/mutation-types.js Added PASSWORD_CHANGE_REQUIRED constant for state management
ui/src/store/modules/user.js Added state and mutations for password change requirement flag, loads user info with limited APIs when flag is set
ui/src/store/getters.js Added getter for passwordChangeRequired state
ui/src/permission.js Added navigation guards to redirect users to force change password page when required
ui/src/config/router.js Registered new forceChangePassword route under user path
ui/public/locales/en.json Added localization strings for password change UI
server/src/main/java/com/cloud/user/AccountManagerImpl.java Added logic to set/remove passwordChangeRequired user detail, loads user details during authentication
server/src/main/java/com/cloud/api/query/vo/UserAccountJoinVO.java Added passwordChangeRequired field to join view object
server/src/main/java/com/cloud/api/query/dao/UserAccountJoinDaoImpl.java Maps passwordChangeRequired to user response
server/src/main/java/com/cloud/api/ApiServer.java Sets passwordChangeRequired in login session when user detail is present
plugins/api/discovery/src/main/java/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java Restricts API list to essential APIs when user requires password change
plugins/api/discovery/src/test/java/org/apache/cloudstack/discovery/ApiDiscoveryTest.java Updated test setup to mock getUserAccountById method
engine/schema/src/main/resources/META-INF/db/views/cloud.user_view.sql Added LEFT JOIN to user_details table for PasswordChangeRequired value
engine/schema/src/main/java/org/apache/cloudstack/resourcedetail/UserDetailVO.java Added PasswordChangeRequired constant
api/src/main/java/org/apache/cloudstack/api/response/UserResponse.java Added passwordChangeRequired field to user API response
api/src/main/java/org/apache/cloudstack/api/response/LoginCmdResponse.java Added passwordChangeRequired field to login API response
api/src/main/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java Added passwordChangeRequired parameter to update user command
api/src/main/java/org/apache/cloudstack/api/ApiConstants.java Added PASSWORD_CHANGE_REQUIRED API constant

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sudo87
Copy link
Collaborator Author

sudo87 commented Dec 19, 2025

@blueorangutan package

@blueorangutan
Copy link

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 16095

@sudo87
Copy link
Collaborator Author

sudo87 commented Dec 19, 2025

@blueorangutan package

@blueorangutan
Copy link

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 16097

@sudo87 sudo87 changed the title Force password change for normal user once admin reset it Allow enforcing password change for a user after reset by admin (root/domain) Dec 19, 2025
@vishesh92 vishesh92 requested a review from Copilot December 19, 2025 08:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 17 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sudo87
Copy link
Collaborator Author

sudo87 commented Dec 19, 2025

@blueorangutan package

@blueorangutan
Copy link

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16106

@sudo87
Copy link
Collaborator Author

sudo87 commented Dec 22, 2025

@blueorangutan test

@blueorangutan
Copy link

@sudo87 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-15039)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 51453 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12294-t15039-kvm-ol8.zip
Smoke tests completed. 149 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_03_deploy_and_scale_kubernetes_cluster Failure 37.17 test_kubernetes_clusters.py

@sudo87
Copy link
Collaborator Author

sudo87 commented Dec 24, 2025

@blueorangutan package

@blueorangutan
Copy link

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

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

clgtm

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16154

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants