[PR #1267] [MERGED] Api change user password #1555

Closed
opened 2026-05-07 01:02:39 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/binwiederhier/ntfy/pull/1267
Author: @wunter8
Created: 1/26/2025
Status: Merged
Merged: 5/24/2025
Merged by: @binwiederhier

Base: mainHead: api-change-user-password


📝 Commits (6)

  • 8f9dafc change user password via accounts API
  • ad7ab18 prevent changing admin passwords
  • 2b40ad9 make staticcheck happy
  • fa48639 make POST create user and PUT update user
  • e36e485 allow changing password or tier with user PUT
  • 0fb60ae test change user password and tier in single request

📊 Changes

5 files changed (+211 additions, -7 deletions)

View changed files

📝 docs/releases.md (+1 -0)
📝 server/server.go (+3 -1)
📝 server/server_admin.go (+43 -1)
📝 server/server_admin_test.go (+163 -4)
📝 server/types.go (+1 -1)

📄 Description

I'm not sure if this is the best way to implement this, but I added a force param to the "add user" request.

If force == true, it will override the password of an existing user (instead of it causing an error saying that a user already exists).

This will let you change a user's password and preserve the user ID in the database (instead of deleting a user and then creating a new one with the same username)

The "add user" endpoint already requires admin credentials to use, and admins can create and delete users, so I didn't think changing a user's password would be much different.

Admins CANNOT change the password of another admin.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/binwiederhier/ntfy/pull/1267 **Author:** [@wunter8](https://github.com/wunter8) **Created:** 1/26/2025 **Status:** ✅ Merged **Merged:** 5/24/2025 **Merged by:** [@binwiederhier](https://github.com/binwiederhier) **Base:** `main` ← **Head:** `api-change-user-password` --- ### 📝 Commits (6) - [`8f9dafc`](https://github.com/binwiederhier/ntfy/commit/8f9dafce2051a14c0daec0bc61a273f46765cda8) change user password via accounts API - [`ad7ab18`](https://github.com/binwiederhier/ntfy/commit/ad7ab18fb737d22f3cbb434665cd49b0048dba44) prevent changing admin passwords - [`2b40ad9`](https://github.com/binwiederhier/ntfy/commit/2b40ad9a129dabbcbe7a90c3be26c9071e50a0ea) make staticcheck happy - [`fa48639`](https://github.com/binwiederhier/ntfy/commit/fa48639517bd65b4b3f20472a015e6f7af409ea2) make POST create user and PUT update user - [`e36e485`](https://github.com/binwiederhier/ntfy/commit/e36e4856c9d04b2ad0e8ad5d080809d45c7b6cd0) allow changing password or tier with user PUT - [`0fb60ae`](https://github.com/binwiederhier/ntfy/commit/0fb60ae72d8387abf6280874d85379cb502d6bca) test change user password and tier in single request ### 📊 Changes **5 files changed** (+211 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/releases.md` (+1 -0) 📝 `server/server.go` (+3 -1) 📝 `server/server_admin.go` (+43 -1) 📝 `server/server_admin_test.go` (+163 -4) 📝 `server/types.go` (+1 -1) </details> ### 📄 Description I'm not sure if this is the best way to implement this, but I added a `force` param to the "add user" request. If `force == true`, it will override the password of an existing user (instead of it causing an error saying that a user already exists). This will let you change a user's password and preserve the user ID in the database (instead of deleting a user and then creating a new one with the same username) The "add user" endpoint already requires admin credentials to use, and admins can create and delete users, so I didn't think changing a user's password would be much different. Admins CANNOT change the password of another admin. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 01:02:39 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#1555
No description provided.