Trigger on mp_Users throws error

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
11/11/2015 8:59:46 AM
Gravatar
Total Posts 2

Trigger on mp_Users throws error

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
 

You must sign in to post in the forums. This thread is closed to new posts.