Send email if login failed and if login success

A place for users and developers of the Xataface to discuss and receive support.

Send email if login failed and if login success

Postby 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 ?
Rrrr7
 
Posts: 14
Joined: Fri Dec 14, 2012 7:37 am

Re: Send email if login failed and if login success

Postby 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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Send email if login failed and if login success

Postby 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 ?
Rrrr7
 
Posts: 14
Joined: Fri Dec 14, 2012 7:37 am

Re: Send email if login failed and if login success

Postby 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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Send email if login failed and if login success

Postby 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/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 !
Rrrr7
 
Posts: 14
Joined: Fri Dec 14, 2012 7:37 am

Re: Send email if login failed and if login success

Postby 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
Rrrr7
 
Posts: 14
Joined: Fri Dec 14, 2012 7:37 am

Re: Send email if login failed and if login success

Postby 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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Send email if login failed and if login success

Postby 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
Rrrr7
 
Posts: 14
Joined: Fri Dec 14, 2012 7:37 am


Return to Xataface Users

Who is online

Users browsing this forum: Bing [Bot] and 4 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved