Table of Contents

Class ValidateUserNotificationArgs

Namespace
Dynamicweb.Frontend.UserManagement.Notifications
Assembly
Dynamicweb.dll

Represents a validate user notification agruments.

public sealed class ValidateUserNotificationArgs : NotificationArgs
Inheritance
ValidateUserNotificationArgs
Inherited Members

Examples

using Dynamicweb.Core.Helpers;
using Dynamicweb.Extensibility.Notifications;
using Dynamicweb.Frontend.UserManagement;
using Dynamicweb.Frontend.UserManagement.Notifications;
using Dynamicweb.Security.UserManagement;
using System.Collections.Generic;

namespace Dynamicweb.Examples.UserManagement.Notifications;

/// <summary>The Class UserValidatedObserverSample represents observer for user validated event</summary>
[Subscribe(Security.UserManagement.Notifications.Notifications.UserValidated)]
public class UserValidatedObserverSample : NotificationSubscriber
{
    /// <summary>This method called when user validated event fires</summary>
    public override void OnNotify(string notification, NotificationArgs args)
    {
        if (args is not ValidateUserNotificationArgs item)
            return;

        User user = item.Subject;
        Dictionary<string, UserManagementFormField> error = item.Errors;
        if (!StringHelper.IsValidEmailAddress(user.Email))
        {
            string key = string.Format("UserManagement_Form_{0}", "Email2");
            error.Add(key, new UserManagementFormField(key, "Email", "The email is not valid from. Custom!"));
        }
    }
}

Constructors

ValidateUserNotificationArgs(User, Dictionary<string, UserManagementFormField>)

Creates a new instance of a class.

public ValidateUserNotificationArgs(User subject, Dictionary<string, UserManagementFormField> errors)

Parameters

subject User

The validated user.

errors Dictionary<string, UserManagementFormField>

Validation errors.

Properties

Errors

Gets the validation errors.

public Dictionary<string, UserManagementFormField> Errors { get; }

Property Value

Dictionary<string, UserManagementFormField>

Validation errors.

Subject

Gets the subject of the notification (user which has been validated).

public User Subject { get; }

Property Value

User

User which has been validated.

To top