sws/auth

Custom authentication package including registration, login, email verification and more.

1.0.x-dev 2021-09-30 12:29 UTC

This package is auto-updated.

Last update: 2025-05-29 01:46:47 UTC


README

SWS Auth is a Complete Build of Laravel 8 with Email Registration Verification. Built on Bootstrap 4.

Build Status License: MIT

About

Auth0 Laravel 8 with user authentication and registration with email confirmation. Uses official [Bootstrap 4](https://getbootstrap.com). This also makes full use of Controllers for the routes and templates for the views. Project can be stood up in minutes.

Features

A Laravel 8.x with Bootstrap 4.x project.

Laravel Auth Features
Built on Laravel 8
Built on Bootstrap 4
Uses MySQL Database (can be changed)
Uses Artisan to manage database migration, schema creations, and create/publish page controller templates
Dependencies are managed with COMPOSER
Makes use of Laravel's Soft Delete Structure
Soft Deleted Users Management System

Installation Instructions

  1. run :
composer require sws/auth

  1. add auth provider to your config/app.php \SWS\Auth\Providers\AuthServiceProvider::class,
  2. Setup your email configuration to your .env file
MAIL_MAILER=smtp
MAIL_HOST=YOUR_MAIL_HOST
MAIL_PORT=2525
MAIL_USERNAME=YOUR_USERNAME
MAIL_PASSWORD=YOUR_PASSWORD
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@example.com
MAIL_FROM_NAME="${APP_NAME}"
  1. From the projects root folder run:
php artisan vendor:publish --tag smart-auth

Optionally Build Cache

  1. From the projects root folder run php artisan config:cache
  2. You can change "email from address" from app/config/smart-auth.php

Routes

+--------+----------+------------------------+----------------------------+-------------------------------------------------------------+---------------------------------------------+
| Domain | Method   | URI                    | Name                       | Action                                                      | Middleware                                  |
+--------+----------+------------------------+----------------------------+-------------------------------------------------------------+---------------------------------------------+
|        | GET|HEAD | /                      |                            | Closure                                                     | web                                         |
|        | GET|HEAD | api/user               |                            | Closure                                                     | api                                         |
|        |          |                        |                            |                                                             | App\Http\Middleware\Authenticate:sanctum    |
|        | POST     | forgot-password        | auth.forgot.password       | SWS\Auth\Http\Controllers\AuthController@postForgotPassword | web                                         |
|        |          |                        |                            |                                                             | App\Http\Middleware\RedirectIfAuthenticated |
|        | GET|HEAD | forgot-password        | auth.forgot.password.index | SWS\Auth\Http\Controllers\AuthController@forgotPassword     | web                                         |
|        |          |                        |                            |                                                             | App\Http\Middleware\RedirectIfAuthenticated |
|        | GET|HEAD | login                  | login                      | SWS\Auth\Http\Controllers\AuthController@loginIndex         | web                                         |
|        |          |                        |                            |                                                             | App\Http\Middleware\RedirectIfAuthenticated |
|        | POST     | login                  | auth.login.check           | SWS\Auth\Http\Controllers\AuthController@postLogin          | web                                         |
|        |          |                        |                            |                                                             | App\Http\Middleware\RedirectIfAuthenticated |
|        | GET|HEAD | logout                 | auth.logout                | SWS\Auth\Http\Controllers\AuthController@logout             | web                                         |
|        | GET|HEAD | register               | register                   | SWS\Auth\Http\Controllers\AuthController@index              | web                                         |
|        |          |                        |                            |                                                             | App\Http\Middleware\RedirectIfAuthenticated |
|        | POST     | register               | auth.register.store        | SWS\Auth\Http\Controllers\AuthController@register           | web                                         |
|        |          |                        |                            |                                                             | App\Http\Middleware\RedirectIfAuthenticated |
|        | GET|HEAD | reset-password/{token} | auth.reset.password.index  | SWS\Auth\Http\Controllers\AuthController@resetPassword      | web                                         |
|        |          |                        |                            |                                                             | App\Http\Middleware\RedirectIfAuthenticated |
|        | POST     | reset-password/{token} | auth.reset.password        | SWS\Auth\Http\Controllers\AuthController@postResetPassword  | web                                         |
|        |          |                        |                            |                                                             | App\Http\Middleware\RedirectIfAuthenticated |
|        | GET|HEAD | sanctum/csrf-cookie    |                            | Laravel\Sanctum\Http\Controllers\CsrfCookieController@show  | web                                         |
|        | GET|HEAD | user-verify/{token}    | auth.email.verify          | SWS\Auth\Http\Controllers\AuthController@verifyEmail        | web                                         |
|        |          |                        |                            |                                                             | App\Http\Middleware\RedirectIfAuthenticated |
+--------+----------+------------------------+----------------------------+-------------------------------------------------------------+---------------------------------------------+

File Tree

auth
├── src
│   ├── config
│   │   └── auth.php
│   ├── database
│   │   └── migrations
│   │       └── create_users_table.php
│   ├── Http
│   │   ├── Controllers
│   │   │   └── AuthController.php
│   │   └── Requests
│   │       └── ResetPasswordRequest.php
│   │       └── StoreUserRequest.php
│   ├── Models
│   │   └── Auth.php
│   ├── Providers
│   │   └── AuthServiceProvider.php
│   ├── Public
│   │   ├── css
│   │   │   └── sws-auth-style.css
│   │   └── js
│   │       └── sws-auth-script.js
│   ├── Resources
│   │   ├── views
│   │   │   └── Auth
│   │   │       ├── passwords
│   │   │       │   ├── forgot.blade.php
│   │   │       │   └── reset.blade.php
│   │   │       ├── login.blade.php
│   │   │       └── register.blade.php
│   │   └── Email
│   │       ├── passwordResetEmail.blade.php
│   │       └── userVerificationEmail.blade.php
│   ├── Routes
│   │   └── web.php
│   ├── Services
│   │   └── AuthService.php
├── vendor
│   ├── composer
│   │   └── installed.json
│   ├── autoload.php
│   └── composer.json
├── composer.json
├── LICENSE
└── README.md

SWS Auth License

auth is licensed under the MIT license. Enjoy!

Contributors

  • Thanks goes to these wonderful people:
  • Please feel free to contribute and make pull requests!