My application logs user logins, login attempts and logouts.
The following code is for 'When LoginAttemptNotification is received':
If EXISTS SystemUser WHERE (SystemUser.LoginName=LoginAttemptNotification.LoginName) Then
FIND SystemUser WHERE SystemUser.LoginName=LoginAttemptNotification.LoginName
ThisSystemUser.LastLoginAttempt=CURRENT_TIMESTAMP
ThisSystemUser.BadLogins=ThisSystemUser.BadLogins+1
ThisSystemUser.IPAddress=LoginAttemptNotification.RemoteAddress
CREATE LoginLog WITH LoginLog.IP=LoginAttemptNotification.RemoteAddress,LoginLog.LogType='LOGINBADPW',LoginLog.WebID=LoginAttemptNotification.LoginName,LoginLog.Description=LoginAttemptNotification.LoginName+' tried invalid password, bad attempts = ' + AS_STRING(ThisSystemUser.BadLogins)
Else
CREATE LoginLog WITH LoginLog.IP=LoginAttemptNotification.RemoteAddress,LoginLog.LogType='LOGINBADID',LoginLog.WebID=LoginAttemptNotification.LoginName,LoginLog.Description=LoginAttemptNotification.LoginName+' not in database'
When I tested this, I got 2 LoginLog records for each login attempt. Is there something wrong with my code, or are 2 LoginAttemptNotifications being generated?
Thank you.