Send email if login failed and if login success
Archived from the Xataface Users forum.
Rrrr7 — Sun Jan 13, 2013 11:44 am
Hi,
I would like to set up my application to automatically send an email to a specified address if someone tries to log in with incorrect username and password and on a succefull login.I would also like to include user’s IP address and all data available in the email body.
Is there a trigger for unsuccessful login ?
shannah — Mon Jan 14, 2013 9:01 am
I don’t think there is trigger for failed logins (I’ll have to check) but they are all logged in a failed logins table that you could monitor periodically to send you this information.
Steve
Rrrr7 — Mon Jan 14, 2013 9:14 am
shannah wrote:I don’t think there is trigger for failed logins (I’ll have to check) but they are all logged in a failed logins table that you could monitor periodically to send you this information.
Steve
Yes, I know that and is very usefull for me, maybe I can add the send email part to the function that inserts the failed logins into the DB failed logins table. What do you think ?
shannah — Mon Jan 14, 2013 10:26 am
I have added a failedLogin trigger to SVN and it will be included with the next release. I have added a wiki page for this trigger:
http://xataface.com/wiki/loginFailed
If you want this trigger in your current version of Xataface, you should be able to just copy the Dataface/AuthenticationTool.php class from SVN into your local copy of Xataface.
http://weblite.ca/svn/dataface/core/tru … onTool.php
-Steve
Rrrr7 — Mon Jan 14, 2013 10:54 am
shannah wrote:I have added a failedLogin trigger to SVN and it will be included with the next release. I have added a wiki page for this trigger:
http://xataface.com/wiki/loginFailedIf you want this trigger in your current version of Xataface, you should be able to just copy the Dataface/AuthenticationTool.php class from SVN into your local copy of Xataface.
http://weblite.ca/svn/dataface/core/tru … onTool.php-Steve
You ARE the man !
Thank You, I will post feedback here !
Rrrr7 — Mon Jan 14, 2013 3:17 pm
Hmm, I’m struggling with the new class from the SVN. I get
- Code: Select all
Fatal error: Call to undefined method Dataface_Application::sessionEnabled() in /home/user/public_html/intranet/Dataface/AuthenticationTool.php on line 194
Line 194 is starts with
- Code: Select all
if ( $app->sessionEnabled() or $app->autoSession ){ $app->startSession($this->conf); } $appdel =& $app->getDelegate();
I’m using v 1.3.3
shannah — Thu Jan 17, 2013 9:00 am
It seems that the authentication tool has other changes that are incompatible with 1.3.3. A better approach might be to just replace the flagFailedAttempt() method of your AuthenticationTool instead of just replacing the whole thing.
-Steve
Rrrr7 — Thu Jan 17, 2013 9:49 am
shannah wrote:It seems that the authentication tool has other changes that are incompatible with 1.3.3. A better approach might be to just replace the flagFailedAttempt() method of your AuthenticationTool instead of just replacing the whole thing.
-Steve
Yes, I figured that out and it works.
I modified the trigger to send an email when failed logins happen, it works well now !
Thank You