Giter VIP home page Giter VIP logo

laravel-email-confirmation's Introduction

Laravel Email Confirmation

This package is to add email confirmation to Laravel 5.4 project.

It should be used after php artisan make:auth command but can also be added to existing project.

There is a french presentation of this package.

Features

  • create a migration to add confirmation columns to users table
  • create routes for confirmation confirmation/resend
    confirmation/{id}/{token}
  • add an artisan command to override login and register views
  • send email notification with registration
  • add translations for notification (there are french and english ones)
  • block login for not confirmed user and launch an alert with resend link for notification
  • block auto login on password reset for not confirmed user

Installation

Add package to your composer.json file :

    composer require bestmomo/laravel-email-confirmation

Add service provider to config/app.php :

    Bestmomo\LaravelEmailConfirmation\ServiceProvider::class,

Make a migration to add columns to users table :

    php artisan migrate

Change trait reference in LoginController :

    use Bestmomo\LaravelEmailConfirmation\Traits\AuthenticatesUsers;

Change trait reference in RegisterController :

    use Bestmomo\LaravelEmailConfirmation\Traits\RegistersUsers;

Change trait reference in ResetPasswordController:

    use Bestmomo\LaravelEmailConfirmation\Traits\ResetsPasswords;

Publish

  • If you have used the php artisan make:auth command

Override login and register views to get confirmation alerts :

    php artisan confirmation:auth
  • If you have custom scaffold

You must add alerts in login and register views. Here are 2 examples with Bootstrap.

Login view :

@if (session('confirmation-success'))
    <div class="alert alert-success">
        {{ session('confirmation-success') }}
    </div>
@endif
@if (session('confirmation-danger'))
    <div class="alert alert-danger">
        {!! session('confirmation-danger') !!}
    </div>
@endif

Register view :

@if (session('confirmation-success'))
    <div class="alert alert-success">
        {{ session('confirmation-success') }}
    </div>
@endif

Optional Publish

If you want to do some changes or add a language you can publish translations :

    php artisan vendor:publish --tag=confirmation:translations

If you want to do some changes to confirmation notification you can make a copy in App :

    php artisan confirmation:notification

laravel-email-confirmation's People

Contributors

bestmomo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.