Skip to content

Commit

Permalink
Merge pull request #338 from reubenmiller/docs-add-change-password-note
Browse files Browse the repository at this point in the history
docs: note that users can only set their own passwords
  • Loading branch information
reubenmiller authored Jan 15, 2024
2 parents ad9cc44 + 8b67d80 commit cda65f2
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
12 changes: 4 additions & 8 deletions api/spec/json/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@
{
"name": "resetUserPassword",
"description": "Reset user password",
"descriptionLong": "The password can be reset either by issuing a password reset email (default), or be specifying a new password.",
"descriptionLong": "The password can be reset either by issuing a password reset email (default), or be specifying a new password.\n\nNote: In more recent Cumulocity IoT versions, you can't set a fixed password for another user.\n",
"method": "PUT",
"path": "user/{tenant}/users/{id}",
"accept": "application/vnd.com.nsn.cumulocity.user+json",
Expand All @@ -518,20 +518,16 @@
"beforeEach": [
"$User = PSc8y\\New-TestUser"
],
"skipTest": false,
"command": "Reset-UserPassword -Id $User.id -Dry",
"afterEach": [
"PSc8y\\Remove-User -Id $User.id"
]
},
{
"description": "Resets a user's password by generating a new password",
"beforeEach": [
"$User = PSc8y\\New-TestUser"
],
"command": "Reset-UserPassword -Id $User.id -NewPassword (New-RandomPassword)",
"afterEach": [
"PSc8y\\Remove-User -Id $User.id"
]
"skipTest": true,
"command": "Reset-UserPassword -Id $User.id -NewPassword (New-RandomPassword)"
}
],
"go": [
Expand Down
11 changes: 6 additions & 5 deletions api/spec/yaml/users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,10 @@ commands:

- name: resetUserPassword
description: Reset user password
descriptionLong: The password can be reset either by issuing a password reset email (default), or be specifying a new password.
descriptionLong: |
The password can be reset either by issuing a password reset email (default), or be specifying a new password.
Note: In more recent Cumulocity IoT versions, you can't set a fixed password for another user.
method: PUT
path: user/{tenant}/users/{id}
accept: 'application/vnd.com.nsn.cumulocity.user+json'
Expand All @@ -389,16 +392,14 @@ commands:
- description: Resets a user's password by sending a reset email to the user
beforeEach:
- $User = PSc8y\New-TestUser
skipTest: false
command: Reset-UserPassword -Id $User.id -Dry
afterEach:
- PSc8y\Remove-User -Id $User.id

- description: Resets a user's password by generating a new password
beforeEach:
- $User = PSc8y\New-TestUser
skipTest: true
command: Reset-UserPassword -Id $User.id -NewPassword (New-RandomPassword)
afterEach:
- PSc8y\Remove-User -Id $User.id
go:
- description: Update a user
command: c8y users resetUserPassword --id "myuser"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Reset user password

The password can be reset either by issuing a password reset email (default), or be specifying a new password.

Note: In more recent Cumulocity IoT versions, you can't set a fixed password for another user.


```
c8y users resetUserPassword [flags]
```
Expand Down
2 changes: 2 additions & 0 deletions docs/go-c8y-cli/docs/cli/psc8y/Users/Reset-UserPassword.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Reset-UserPassword
## DESCRIPTION
The password can be reset either by issuing a password reset email (default), or be specifying a new password.

Note: In more recent Cumulocity IoT versions, you can't set a fixed password for another user.

## EXAMPLES

### EXAMPLE 1
Expand Down
5 changes: 4 additions & 1 deletion pkg/cmd/users/resetuserpassword/resetUserPassword.auto.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tools/PSc8y/Public/Reset-UserPassword.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Reset user password
.DESCRIPTION
The password can be reset either by issuing a password reset email (default), or be specifying a new password.
Note: In more recent Cumulocity IoT versions, you can't set a fixed password for another user.
.LINK
https://reubenmiller.github.io/go-c8y-cli/docs/cli/c8y/users_resetUserPassword
Expand Down
4 changes: 2 additions & 2 deletions tools/PSc8y/Tests/Reset-UserPassword.auto.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Describe -Name "Reset-UserPassword" {

}

It "Resets a user's password by sending a reset email to the user" {
It -Skip "Resets a user's password by sending a reset email to the user" {
$Response = PSc8y\Reset-UserPassword -Id $User.id -Dry
$LASTEXITCODE | Should -Be 0
$Response | Should -Not -BeNullOrEmpty
}

It "Resets a user's password by generating a new password" {
It -Skip "Resets a user's password by generating a new password" {
$Response = PSc8y\Reset-UserPassword -Id $User.id -NewPassword (New-RandomPassword)
$LASTEXITCODE | Should -Be 0
$Response | Should -Not -BeNullOrEmpty
Expand Down

0 comments on commit cda65f2

Please sign in to comment.