Custom Authentication (SignIn / SignUp) in Laravel

Custom Authentication (SignIn / SignUp) in Laravel

As routing and pagination is very simple in laravel, authentication is not much different, it is very simple too, everything is configured out of the box.

Working Demo      Project on Github

 

By default, laravel comes with 2 authentication controllers: Auth Controller and Password Controller.
Auth Controller, handles new registrations and authentication, Password Controller, manages forgotten passwords.

Default routes for authentication are,

So when we go to localhost:8000/auth/login , login form appears, of course we have place our view files in resources directory, in previous versions of laravel, it shipped with these view files too.

We are not going to use these, as we completely customize our authentication.We ‘ll use modal for SignIn/SignUp as modals are very popular these days and very fancy too.

Note : we are not using a validations here, validations are discussed in separate post here, make sure you look at it

Firstly, lets create a modal, we are using w3css here,
In resources/views location, create a new file named customAuthentication.blade.php, as we said we use w3css modal along with w3css tabs for login and register.

above line of code calls the modal when SignIn/SignUp is clicked,
and the code for modal is,

Now, when we fill the signup form, it is sent to register controller,  there we store the user details in the users table, here we use the default table users came along with laravel installation.

After registration, we will be able to login,

Logout functionality is done flushing session, and calling Auth::logout function,

 

and routes file will look like,

Working Demo      Project on Github

 

See the output in screenshots below,

justLaravel - Custom Authentication
justLaravel – Custom Authentication
justLaravel - Custom Authentication
justLaravel – Custom Authentication
justLaravel – Custom Authentication
justLaravel – Custom Authentication
justLaravel – Custom Authentication
justLaravel – Custom Authentication
justLaravel – Custom Authentication
justLaravel – Custom Authentication

Working Demo      Project on Github

 

We did not check for validations here, we look at validations in seperate post. Feel free to look at previous posts on routing and pagination



5 thoughts on “Custom Authentication (SignIn / SignUp) in Laravel”

  • 18
    Lucas Mahle on April 22, 2016 Reply

    Why do not you put these codes in Gist? Not the entire application, but the created codes and complete views.

    Great post.

  • 20
    mandeep on July 13, 2016 Reply

    Nice one tutorial….
    I want to make a user/client/cumstomer/employee etc.(one of them)form With login socia sites network. How i make it .
    My aim is when i run this command php artisan make:auth
    This make the admin pannel for our app.
    2. How i make a news letters subscription function in laravel 5.2 for latest news.
    3.How i use Paypal functionality .And how i check the account detail on my local system .Besause i want to work on localhost and i see the user payment detail in laravel 5.2
    Please tell me about these topic…

  • 22
    Nasar on June 17, 2017 Reply

    useless

Leave a Reply