2017 © Pedro Peláez
 

library login-activity

This package will save login and logout activity of user

image

mahfuz/login-activity

This package will save login and logout activity of user

  • Wednesday, June 27, 2018
  • by git-mahfuz
  • Repository
  • 1 Watchers
  • 2 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel Login Activity

This package will save successful login, failed login attempt and logout activity of user
Features:
  • Logging Successful Login Event with IP and User Agent Information.
  • Logging Logout Event with IP and User Agent Information.
  • Logging Failed Login Events with IP and User Agent Information.
  • Sending Email to User Upon Multiple Failed Login Attempts to Their Account On a Certain Time Interval to let them know about suspicious activity in their account.

Installation instructions for Laravel 5.3.*

Considering user_id as your primary column of users table follow below steps to install this package -, (*1)

1. Installation

Install the package by running below command in your terminal -, (*2)

composer require mahfuz/login-activity:dev-master, (*3)

2. Adding Servicer Provider to Providers Array

Add below Service Provider in your providers array of config/app.php file, (*4)

Mahfuz\LoginActivity\LoginActivityServiceProvider::class,, (*5)

3. Running Migrations

Run php artisan migrate in your terminal. This will run a migration file required to make this project work which will create a table name login_activities in your database., (*6)

4. Adding Event Listeners

Add below event listeners to $listen array of app/Providers/EventServiceProvider.php, (*7)

```$xslt 'Illuminate\Auth\Events\Login' => [ 'Mahfuz\LoginActivity\Listeners\LogSuccessfulLogin', ],, (*8)

'Illuminate\Auth\Events\Failed' => [ 'Mahfuz\LoginActivity\Listeners\LogFailedLogin', ],, (*9)

'Illuminate\Auth\Events\Logout' => [ 'Mahfuz\LoginActivity\Listeners\LogSuccessfulLogout', ], ```, (*10)

5. Accessing Routes and Views

To view login activities visit this URL http://localhost:8000/login-activity., (*11)

*** Please note that url('login-activity') is protected by auth middleware. So, only logged in user can able to browse this route path., (*12)

6. Publishing Views, Migrations and Config files

Go to your project root via terminal and run php artisan vendor:publish, (*13)

Once done check config/login-activity.php, you can configure it to whether send email upon 'X' failed login attempts in last 'N' minutes or not., (*14)

Also check resources/views/vendor/login-activity if you want to update login activity view and failed login attempt email view., (*15)

That's all., (*16)

Sample View:

Alt text, (*17)

Happy Coding!

The Versions

27/06 2018

dev-master

9999999-dev

This package will save login and logout activity of user

  Sources   Download

MIT

by Avatar mahfuz