Merge pull request #2331 from umbraco/v15/feature/user-workspace-validation
user workspace validation
This commit is contained in:
@@ -219,7 +219,7 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal
|
||||
/**
|
||||
* Validate this context, all the validators of this context will be validated.
|
||||
* Notice its a recursive check meaning sub validation contexts also validates their validators.
|
||||
* @returns succeed {Promise<boolean>} - Returns a promise that resolves to true if the validator succeeded, this depends on the validators and wether forceSucceed is set.
|
||||
* @returns succeed {Promise<boolean>} - Returns a promise that resolves to true if the validation succeeded.
|
||||
*/
|
||||
async validate(): Promise<void> {
|
||||
// TODO: clear server messages here?, well maybe only if we know we will get new server messages? Do the server messages hook into the system like another validator?
|
||||
|
||||
@@ -6,6 +6,7 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import type { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
|
||||
import type { UmbUiCultureInputElement } from '@umbraco-cms/backoffice/localization';
|
||||
import { umbBindToValidation } from '@umbraco-cms/backoffice/validation';
|
||||
|
||||
@customElement('umb-user-workspace-profile-settings')
|
||||
export class UmbUserWorkspaceProfileSettingsElement extends UmbLitElement {
|
||||
@@ -79,6 +80,7 @@ export class UmbUserWorkspaceProfileSettingsElement extends UmbLitElement {
|
||||
@change="${this.#onEmailChange}"
|
||||
required
|
||||
required-message=${this.localize.term('user_emailRequired')}
|
||||
${umbBindToValidation(this)}
|
||||
value=${ifDefined(this._user?.email)}></uui-input>
|
||||
</umb-property-layout>
|
||||
`;
|
||||
|
||||
@@ -9,6 +9,7 @@ import type { UmbSubmittableWorkspaceContext } from '@umbraco-cms/backoffice/wor
|
||||
import { UmbSubmittableWorkspaceContextBase } from '@umbraco-cms/backoffice/workspace';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
|
||||
import { UmbValidationContext } from '@umbraco-cms/backoffice/validation';
|
||||
|
||||
type EntityType = UmbUserDetailModel;
|
||||
|
||||
@@ -40,6 +41,8 @@ export class UmbUserWorkspaceContext
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host, UMB_USER_WORKSPACE_ALIAS);
|
||||
|
||||
this.addValidationContext(new UmbValidationContext(this));
|
||||
|
||||
this.routes.setRoutes([
|
||||
{
|
||||
path: 'edit/:id',
|
||||
|
||||
Reference in New Issue
Block a user