I have a trigger on the mp_Users table that appears to be working, but the Create User page in Mojo throws an error. Here is what is in the system log...
2015-11-11 08:59:40,366 ERROR 192.168.200.10 - en-US - /admin/manageusers.aspx?userid=-1 - mojoPortal.Web.Global - Referrer(https://rhclients.wfcorp.com/admin/manageusers.aspx?userid=-1) useragent Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at mojoPortal.Data.DBSiteUser.AddUser(Guid siteGuid, Int32 siteId, String fullName, String loginName, String email, String password, String passwordSalt, Guid userGuid, DateTime dateCreated, Boolean mustChangePwd, String firstName, String lastName, String timeZoneId, DateTime dateOfBirth, Boolean emailConfirmed, Int32 pwdFormat, String passwordHash, String securityStamp, String phoneNumber, Boolean phoneNumberConfirmed, Boolean twoFactorEnabled, Nullable`1 lockoutEndDateUtc)
at mojoPortal.Business.SiteUser.Create()
at mojoPortal.Web.AdminUI.ManageUsers.CreateUser()
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
and here is my trigger...
ALTER trigger [dbo].[tr_UserCreated]
ON [dbo].[mp_Users]
AFTER INSERT
AS BEGIN
Set NOCOUNT ON;
Declare
@Email varchar(MAX)
,@Name varchar(MAX)
,@Pwd varchar(MAX)
,@Salt varchar(MAX)
,@SiteID varchar(MAX)
,@cmd varchar(8000)
select
@Email = Email
,@Pwd = Pwd
,@Salt = PasswordSalt
,@Name = Name
,@SiteID = SiteGuid
from inserted
if (@Email is not null and @Pwd is not null and @Name is not null and @SiteID is not null and @SiteID like 'E636%')
BEGIN
select @cmd = 'M:\CryptoTool\CreateADUser.exe "' + @Email + '" "' + @Pwd + '" "' + @Salt + '" "' + @Email + '" "' + @Name + '"'
INSERT INTO [dbo].[TR_Log] ([Email],[NewPwd]) VALUES (@Email, @cmd)
EXEC master ..xp_cmdshell @cmd
END
END