Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Conversation

@iOvergaard
Copy link
Collaborator

@iOvergaard iOvergaard commented Apr 10, 2024

Description

Adds a model to add buttons to the current user modal. This will also allow extensions to unregister the built-in Edit and Change Password buttons, which could be needed for instance if you don't want to allow externally created users to edit their local user.

The buttons will show up in the red circle:

image

The next step is to convert our buttons to this new type, which will come in another PR.

How to test

To test it you need to register a button with an API:

// manifest
	{
		type: 'currentUserAction',
		kind: 'default',
		alias: 'Umb.CurrentUser.Button.ChangePassword',
		name: 'Current User Change Password Button',
		weight: 900,
		api: UmbChangePasswordCurrentUserAction,
		meta: {
			label: '#general_changePassword',
			icon: 'lock',
		},
	},
// API
import { UmbActionBase } from '@umbraco-cms/backoffice/action';
import type { UmbCurrentUserAction, UmbCurrentUserActionArgs } from '@umbraco-cms/backoffice/extension-registry';

export class UmbChangePasswordCurrentUserAction<ArgsMetaType = never>
	extends UmbActionBase<UmbCurrentUserActionArgs<ArgsMetaType>>
	implements UmbCurrentUserAction<ArgsMetaType>
{
	async getHref() {
		return undefined;
	}

	async execute() {
		alert('the user wants to change their password');
	}
}

@iOvergaard iOvergaard marked this pull request as ready for review April 10, 2024 15:25
@iOvergaard iOvergaard requested a review from leekelleher April 10, 2024 15:25
Copy link
Member

@leekelleher leekelleher left a comment

Choose a reason for hiding this comment

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

Great addition, works well! 🚀

@leekelleher leekelleher merged commit 06d4e9c into main Apr 10, 2024
@leekelleher leekelleher deleted the feature/user-profile-actions branch April 10, 2024 17:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants