Page 1 of 1

Send email if login failed and if login success

PostPosted: Sun Jan 13, 2013 11:44 am
by Rrrr7
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 ?

Re: Send email if login failed and if login success

PostPosted: Mon Jan 14, 2013 9:01 am
by shannah
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

Re: Send email if login failed and if login success

PostPosted: Mon Jan 14, 2013 9:14 am
by Rrrr7
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 ?

Re: Send email if login failed and if login success

PostPosted: Mon Jan 14, 2013 10:26 am
by shannah
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

Re: Send email if login failed and if login success

PostPosted: Mon Jan 14, 2013 10:54 am
by Rrrr7
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/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

You ARE the man ! :D

Thank You, I will post feedback here !

Re: Send email if login failed and if login success

PostPosted: Mon Jan 14, 2013 3:17 pm
by Rrrr7
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

Re: Send email if login failed and if login success

PostPosted: Thu Jan 17, 2013 9:00 am
by shannah
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

Re: Send email if login failed and if login success

PostPosted: Thu Jan 17, 2013 9:49 am
by Rrrr7
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