mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
🐛 Fixed success state on change password button. (#17410)
closes https://github.com/TryGhost/Product/issues/3604 - The change password button in the user settings wasn't updating correctly. - the saveNewPasswordTask() wasn't returning anything, causing ` this.get('task.last.value')` to return undefined in the `isSuccess` method. - This fix ensures that there is a value attached to the `task.last.value` so that the condition for a successful save checks out. --- <!-- Leave the line below if you'd like GitHub Copilot to generate a summary from your commit --> <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at a6a76eb</samp> Improved error handling and feedback for changing user passwords in the settings UI. Modified `saveNewPasswordTask` function in `ghost/admin/app/controllers/settings/staff/user.js` to catch and display errors and return user object.
This commit is contained in:
parent
368f6c57a6
commit
6dc000e247
@ -326,8 +326,15 @@ export default class UserController extends Controller {
|
||||
|
||||
@task
|
||||
*saveNewPasswordTask() {
|
||||
yield this.user.saveNewPasswordTask.perform();
|
||||
document.querySelector('#password-reset')?.reset();
|
||||
try {
|
||||
const user = yield this.user.saveNewPasswordTask.perform();
|
||||
document.querySelector('#password-reset')?.reset();
|
||||
return user;
|
||||
} catch (error) {
|
||||
if (error) {
|
||||
this.notifications.showAPIError(error, {key: 'user.update'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@action
|
||||
|
Loading…
Reference in New Issue
Block a user