Click or drag to resize

ValidateUserNotificationArgs Class

Represents a validate user notification agruments.
Inheritance Hierarchy
SystemObject
  Dynamicweb.Extensibility.NotificationsNotificationArgs
    Dynamicweb.UserManagement.NotificationsValidateUserNotificationArgs

Namespace:  Dynamicweb.UserManagement.Notifications
Assembly:  Dynamicweb.UserManagement (in Dynamicweb.UserManagement.dll) Version: 2.3.0
Syntax
public class ValidateUserNotificationArgs : NotificationArgs

The ValidateUserNotificationArgs type exposes the following members.

Constructors
  NameDescription
Public methodValidateUserNotificationArgs
Creates a new instance of a class.
Top
Properties
  NameDescription
Public propertyErrors
Gets the validation errors.
Public propertySubject
Gets the subject of the notification (user which has been validated).
Top
Remarks
Examples
Validate user notification subscriber
using System.Collections.Generic;

using Dynamicweb.Extensibility.Notifications;
using Dynamicweb.UserManagement.Frontend;
using Dynamicweb.UserManagement.Notifications;
using Dynamicweb.Security.UserManagement;
using Dynamicweb.Core.Helpers;

namespace Dynamicweb.UserManagement.Examples.Notifications
{
    /// <summary>The Class UserValidatedObserverSample represents observer for user validated event</summary>
    [Subscribe(Dynamicweb.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 == null || !(args is ValidateUserNotificationArgs))
                return;
            ValidateUserNotificationArgs item = (ValidateUserNotificationArgs)args;
            User user = item.Subject;
            Dictionary<string, UMFormField> error = item.Errors;
            if(!StringHelper.IsValidEmailAddress(user.Email))
            {
                string key = string.Format("UserManagement_Form_{0}", "Email2");
                error.Add(key, new UMFormField(key, "Email", "The email is not valid from. Custom! "));
            }
        }
    }
}
See Also