![]() | ValidateUserNotificationArgs Class |
Namespace: Dynamicweb.UserManagement.Notifications
The ValidateUserNotificationArgs type exposes the following members.
Name | Description | |
---|---|---|
![]() | ValidateUserNotificationArgs |
Creates a new instance of a class.
|
Name | Description | |
---|---|---|
![]() | Errors |
Gets the validation errors.
|
![]() | Subject |
Gets the subject of the notification (user which has been validated).
|
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! ")); } } } }