PHP package built for Laravel 5.* to easily handle a user email verification and validate the email

Overview

jrean/laravel-user-verification is a PHP package built for Laravel 5.* & 6.* & 7.* & 8.* to easily handle a user verification and validate the e-mail.

Latest Stable Version Total Downloads License

VERSIONS

This package is Laravel 8.0 compliant.

laravel/branch 2.2 3.0 4.1 5.0 6.0 7.0 8.0 9.0 master
5.0.* x
5.1.* x
5.2.* x
5.3.* x
5.4.* x
5.5.* x
5.6.* x
5.7.* x
5.8.* x
6.0.* x
7.0.* x
8.0.* x x

ABOUT

  • Generate and store a verification token for a registered user
  • Send or queue an e-mail with the verification token link
  • Handle the token verification
  • Set the user as verified
  • Relaunch the process anytime

Table of Contents

INSTALLATION

This project can be installed via Composer. To get the latest version of Laravel User Verification, add the following line to the require block of your composer.json file:

{
    "require": {
        "jrean/laravel-user-verification": "dev-master"
    }

}

You'll then need to run composer install or composer update to download the package and have the autoloader updated.

Or run the following command:

composer require jrean/laravel-user-verification

Add the Service Provider & Facade/Alias

Once Larvel User Verification is installed, you need to register the service provider in config/app.php. Make sure to add the following line above the RouteServiceProvider.

Jrean\UserVerification\UserVerificationServiceProvider::class,

You may add the following aliases to your config/app.php:

'UserVerification' => Jrean\UserVerification\Facades\UserVerification::class,

Publish the package config file by running the following command:

php artisan vendor:publish --provider="Jrean\UserVerification\UserVerificationServiceProvider" --tag="config"

CONFIGURATION

The model representing the User must implement the authenticatable interface Illuminate\Contracts\Auth\Authenticatable which is the default with the Eloquent User model.

Migration

The table representing the user must be updated with two new columns, verified and verification_token. This update will be performed by the migrations included with this package.

It is mandatory that the two columns are on the same table where the user's e-mail is stored. Please make sure you do not already have those fields on your user table.

To run the migrations from this package use the following command:

php artisan migrate --path="/vendor/jrean/laravel-user-verification/src/resources/migrations"

The package tries to guess your user table by checking what is set in the auth providers users settings. If this key is not found, the default App\User will be used to get the table name.

To customize the migration, publish it with the following command:

php artisan vendor:publish --provider="Jrean\UserVerification\UserVerificationServiceProvider" --tag="migrations"

Middleware

Default middleware

This package provides an optional middleware throwing a UserNotVerifiedException. Please refer to the Laravel Documentation to learn more about how to work with the exception handler.

To register the default middleware add the following lines to the $routeMiddleware array within the app/Http/Kernel.php file:

protected $routeMiddleware = [
    // …
    'isVerified' => \Jrean\UserVerification\Middleware\IsVerified::class,

Apply the middleware on your routes:

Route::group(['middleware' => ['isVerified']], function () {
    // …

Custom middleware

Create your own custom middleware using the following artisan command:

php artisan make:middleware IsVerified

For more details about middlewares, please refer to the Laravel Documentation.

E-MAIL

This package provides a method to send an e-mail with a link containing the verification token.

  • send(AuthenticatableContract $user, $subject, $from = null, $name = null)

By default the package will use the from and name values defined into the config/mail.php file:

    'from' => ['address' => '', 'name' => ''],

If you want to override the values, simply set the $from and (optional) $name parameters.

Refer to the Laravel documentation for the proper e-mail component configuration.

E-mail View

The user will receive an e-mail with a link leading to the getVerification() method (endpoint). The view will receive a $user variable which contains the user details such as the verification token.

The package allow you to use both traditional blade view files and markdown.

By default a sample e-mail view is loaded to get you started with:

Click here to verify your account: <a href="{{ $link = route('email-verification.check', $user->verification_token) . '?email=' . urlencode($user->email) }}">{{ $link }}</a>

If you prefer to use Markdown instead, update the package config file user-verification.php in the config directory and replace the following:

'email' => [
    'type' => 'default',
],

by:

'email' => [
    'type' => 'markdown',
],

If you want to customize the e-mail views, run the following command to publish them and edit them to your needs:

The URL must contain the verification token as parameter + (mandatory) a query string with the user's e-mail as parameter.

php artisan vendor:publish --provider="Jrean\UserVerification\UserVerificationServiceProvider" --tag="views"

The view will be available in the resources/views/vendor/laravel-user-verification/ directory.

ERRORS

This package throws several exceptions. You are free to use try/catch statements or to rely on the Laravel built-in exceptions handler.

  • ModelNotCompliantException

The model instance provided is not compliant with this package. It must implement the authenticatable interface Illuminate\Contracts\Auth\Authenticatable

  • TokenMismatchException

Wrong verification token.

  • UserIsVerifiedException

The given user is already verified.

  • UserNotVerifiedException

The given user is not yet verified.

  • UserNotFoundException

No user found for the given e-mail address.

  • UserHasNoEmailException

User email property is null or empty.

Error View

By default the user-verification.blade.php view will be loaded for the verification error route /email-verification/error. If an error occurs, the user will be redirected to this route and this view will be rendered.

To customize the view, publish it with the following command:

php artisan vendor:publish --provider="Jrean\UserVerification\UserVerificationServiceProvider" --tag="views"

The view will be available in the resources/views/vendor/laravel-user-verification/ directory and can be customized.

USAGE

Routes

By default this packages ships with two routes.

Route::get('email-verification/error', 'Auth\RegisterController@getVerificationError')->name('email-verification.error');
Route::get('email-verification/check/{token}', 'Auth\RegisterController@getVerification')->name('email-verification.check');

Overriding package routes

To define your own custom routes, put the package service provider call before the RouteServiceProvider call in the config/app.php file.

   /*
    * Package Service Providers...
    */
    Jrean\UserVerification\UserVerificationServiceProvider::class,

   /*
    * Application Service Providers...
    */
    // ...
    App\Providers\RouteServiceProvider::class,

Then, add your custom routes in your route file.

Traits

The package offers three (3) traits for a quick implementation. Only VerifiesUsers trait is mandatory and includes RedirectsUsers.

Jrean\UserVerification\Traits\VerifiesUsers

Jrean\UserVerification\Traits\RedirectsUsers

and:

Jrean\UserVerification\Traits\UserVerification

This last one offers two methods that can be added to the User model.

  • isVerified checks if a user is marked as verified.
  • isPendingVerification checks if a verification process has been initiated for a user.

Add the use statement to your User model and use the UserVerification within the class:

Endpoints

The two (2) following methods are included into the VerifiesUsers trait and called by the default package routes.

  • getVerification(Request $request, $token)

Handle the user verification.

  • getVerificationError()

Do something if the verification fails.

API

The package public API offers eight (8) methods.

  • generate(AuthenticatableContract $user)

Generate and save a verification token for the given user.

  • send(AuthenticatableContract $user, $subject = null, $from = null, $name = null)

Send by e-mail a link containing the verification token.

  • sendQueue(AuthenticatableContract $user, $subject = null, $from = null, $name = null)

Queue and send by e-mail a link containing the verification token.

  • sendLater($seconds, AuthenticatableContract $user, $subject = null, $from = null, $name = null)

Send later by e-mail a link containing the verification token.

  • process($email, $token, $userTable)

Process the token verification for the given e-mail and token.

For the sendQueue, sendLater and sendLaterOn methods, you must configure your queues before using this feature.

Facade

The package offers a facade UserVerification::.

Attributes/Properties

To customize the package behaviour and the redirects you can implement and customize six (6) attributes/properties:

  • $redirectIfVerified = '/';

Where to reditect if the authenticated user is already verified.

  • $redirectAfterVerification = '/';

Where to redirect after a successful verification token verification.

  • $redirectIfVerificationFails = '/email-verification/error';

Where to redirect after a failling token verification.

  • $verificationErrorView = 'laravel-user-verification::user-verification';

Name of the view returned by the getVerificationError method.

  • $verificationEmailView = 'laravel-user-verification::email'

Name of the default e-mail view.

  • $userTable = 'users';

Name of the default table used for managing users.

Translations

To customize the translations you may publish the files to your resources/lang/vendor folder using the following command:

php artisan vendor:publish --provider="Jrean\UserVerification\UserVerificationServiceProvider" --tag="translations"

This will add laravel-user-verification/en/user-verification.php to your vendor folder. By creating new language folders, like de or fr and placing a user-verification.php with the translations inside, you can add translations for other languages. You can find out more about localization in the Laravel documentation.

Auto-login

If you wish to automaticaly log in the user after the verification process, update the package config file user-verification.php in the config directory and replace the following:

'auto-login' => false,

by:

'auto-login' => true,

Customize

You can customize the package behaviour by overriding/overwriting the public methods and the attributes/properties. Dig into the source.

GUIDELINES

This package doesn't require the user to be authenticated to perform the verification. You are free to implement any flow you may want to achieve.

This package wishes to let you be creative while offering you a predefined path. The following guidelines assume you have configured Laravel for the package as well as created and migrated the migration according to this documentation and the previous documented steps.

Note that by default the behaviour of Laravel is to return an authenticated user after the registration step.

Example

The following code sample aims to showcase a quick and basic implementation following Laravel logic. You are free to implement the way you want. It is highly recommended to read and to understand the way Laravel implements registration/authentication.

  • Define the e-mail view.

Edit the app\Http\Controllers\Auth\RegisterController.php file.

  • Import the VerifiesUsers trait (mandatory)
  • Overwrite and customize the redirect attributes/properties paths available within the RedirectsUsers trait included by the VerifiesUsers trait. (not mandatory)
  • Overwrite the contructor (not mandatory)
  • Overwrite the register() method (mandatory)
    namespace App\Http\Controllers\Auth;

    use App\User;
    use App\Http\Controllers\Controller;
    use Illuminate\Support\Facades\Validator;
    use Illuminate\Foundation\Auth\RegistersUsers;

    use Illuminate\Http\Request;
    use Illuminate\Auth\Events\Registered;
    use Jrean\UserVerification\Traits\VerifiesUsers;
    use Jrean\UserVerification\Facades\UserVerification;

    class RegisterController extends Controller
    {
        /*
        |--------------------------------------------------------------------------
        | Register Controller
        |--------------------------------------------------------------------------
        |
        | This controller handles the registration of new users as well as their
        | validation and creation. By default this controller uses a trait to
        | provide this functionality without requiring any additional code.
        |
        */

        use RegistersUsers;

        use VerifiesUsers;

        /**
         * Where to redirect users after registration.
         *
         * @var string
         */
        protected $redirectTo = '/home';

        /**
         * Create a new controller instance.
         *
         * @return void
         */
        public function __construct()
        {
            // Based on the workflow you need, you may update and customize the following lines.

            $this->middleware('guest', ['except' => ['getVerification', 'getVerificationError']]);
        }

        /**
         * Get a validator for an incoming registration request.
         *
         * @param  array  $data
         * @return \Illuminate\Contracts\Validation\Validator
         */
        protected function validator(array $data)
        {
            return Validator::make($data, [
                'name' => 'required|max:255',
                'email' => 'required|email|max:255|unique:users',
                'password' => 'required|min:6|confirmed',
            ]);
        }

        /**
         * Create a new user instance after a valid registration.
         *
         * @param  array  $data
         * @return User
         */
        protected function create(array $data)
        {
            return User::create([
                'name' => $data['name'],
                'email' => $data['email'],
                'password' => bcrypt($data['password']),
            ]);
        }

        /**
         * Handle a registration request for the application.
         *
         * @param  \Illuminate\Http\Request  $request
         * @return \Illuminate\Http\Response
         */
        public function register(Request $request)
        {
            $this->validator($request->all())->validate();

            $user = $this->create($request->all());

            event(new Registered($user));

            $this->guard()->login($user);

            UserVerification::generate($user);

            UserVerification::send($user, 'My Custom E-mail Subject');

            return $this->registered($request, $user)
                            ?: redirect($this->redirectPath());
        }
    }

At this point, after registration, an e-mail is sent to the user. Click the link within the e-mail and the user will be verified against the token.

If you want to perform the verification against an authenticated user you must update the middleware exception to allow getVerification and getVerificationError routes to be accessed.

$this->middleware('guest', ['except' => ['getVerification', 'getVerificationError']]);

RELAUNCH THE PROCESS ANYTIME

If you want to regenerate and resend the verification token, you can do this with the following two lines:

UserVerification::generate($user);
UserVerification::send($user, 'My Custom E-mail Subject');

The generate method will generate a new token for the given user and change the verified column to 0. The send method will send a new e-mail to the user.

LARAVEL SPARK

For Laravel Spark integration, follow this article from Ian Fagg

CONTRIBUTE

Feel free to comment, contribute and help. 1 PR = 1 feature.

LICENSE

Laravel User Verification is licensed under The MIT License (MIT).

Comments
  • Migration Duplicate, Column already exists

    Migration Duplicate, Column already exists

    @fake-fur

    this happened running migrations on empty database
    
    [Illuminate\Database\QueryException]
    SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'verified' (SQL: alter table users add verified tinyint(1)
    not n
    ull default '0', add verification_token varchar(255) null)
    [PDOException] SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'verified'
    

    This means you already have the column in your table. Why do you try to run the migration again? Apparently your table is already set up. Did you alter your user table migration to include this verified field?

    If so you should remove it from the user table migration.

    opened by lukasoppermann 32
  • Add resend route

    Add resend route

    I think resending a verification email is a very typical thing, I see it on nearly every platform. I think it would be good to add a default route that does the resend and redirects back to the page the user comes from.

    enhancement 
    opened by lukasoppermann 20
  • Cannot use Jrean\UserVerification\Facades\UserVerification as UserVerification because the name is already in use

    Cannot use Jrean\UserVerification\Facades\UserVerification as UserVerification because the name is already in use

    <?php
    
    namespace App\Models;
    
    use App\Models\Messages\Dialog;
    use App\Traits\HasRoles;
    use Carbon\Carbon;
    use \Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
    use Illuminate\Auth\Passwords\CanResetPassword;
    use Illuminate\Database\Eloquent\SoftDeletes;
    use Illuminate\Foundation\Auth\User as Authenticatable;
    use Illuminate\Notifications\Notifiable;
    use Illuminate\Support\Facades\Cache;
    use Jrean\UserVerification\Traits\UserVerification;
    use Watson\Rememberable\Rememberable;
    
    class User extends Authenticatable implements CanResetPasswordContract
    {
        use Notifiable, SoftDeletes, HasRoles, Rememberable,  UserVerification, CanResetPassword;
    
    
    <?php
    
    namespace App\Http\Controllers\Auth;
    
    use App\Http\Controllers\Controller;
    use App\Models\User;
    use Carbon\Carbon;
    use Illuminate\Foundation\Auth\RegistersUsers;
    use Illuminate\Http\Request;
    use Illuminate\Support\Facades\Validator;
    use Jrean\UserVerification\Facades\UserVerification;
    use Jrean\UserVerification\Traits\VerifiesUsers;
    
    class RegisterController extends Controller
    {
        /*
        |--------------------------------------------------------------------------
        | Register Controller
        |--------------------------------------------------------------------------
        |
        | This controller handles the registration of new users as well as their
        | validation and creation. By default this controller uses a trait to
        | provide this functionality without requiring any additional code.
        |
        */
    
        use RegistersUsers, VerifiesUsers;
    
        /**
         * Where to redirect users after registration.
         *
         * @var string
         */
        protected $redirectTo = '/login';
        protected $redirectAfterVerification = '/login';
    
        /**
         * Create a new controller instance.
         *
         * @return void
         */
        public function __construct()
        {
            parent::__construct();
            $this->middleware('guest', ['except' => ['getVerification', 'getVerificationError']]);
        }
    
        /**
         * Get a validator for an incoming registration request.
         *
         * @param  array $data
         * @return \Illuminate\Contracts\Validation\Validator
         */
        protected function validator(array $data)
        {
            return Validator::make($data, [
                'accept-rules' => 'accepted',
                'name' => 'required|string|alpha_num|max:32|unique:users',
                'email' => 'required|email|max:128|unique:users',
                'password' => 'required|min:6|max:32|confirmed',
                'g-recaptcha-response' => 'recaptcha',
            ]);
        }
    
        /**
         * Create a new user instance after a valid registration.
         *
         * @param  array $data
         * @return User
         */
        protected function create(array $data)
        {
            return User::create([
                'name' => $data['name'],
                'email' => $data['email'],
                'password' => bcrypt($data['password']),
                'money_hold_until' => Carbon::now()->addDays(1)
            ]);
        }
    
        /**
         * Handle a registration request for the application.
         *
         * @param  \Illuminate\Http\Request $request
         * @return \Illuminate\Http\Response
         */
        public function register(Request $request)
        {
            $this->validator($request->all())->validate();
    
            $user = $this->create($request->all());
    
            UserVerification::generate($user);
            UserVerification::send($user, env('SITE_NAME') . ' - Подтверждение электронной почты');
    
            return redirect($this->redirectPath())->with('message', 'Подтвердите аккаунт по электронной почте');
        }
    }
    
    

    if i remove use Jrean\UserVerification\Traits\UserVerification; from user model it work, but not sure that is the best way. what is the solution of this problem? can someone help?

    opened by n0n0n0n0 19
  • Error: property of non-object

    Error: property of non-object

    Hello,

    I'm getting error: Attempt to assign property of non-object which is here: Line no 255 $user->table = $table; File: UserVerification.php

    I have dump $user to check and found it has all the users table field but it does't have "table" key, so that is why it throws this error.

    Furthermore, I'm getting "Trying to get property of non-object" on line no 270 if ($user->verified == true) in that same file.

    Again I checked $user, now this time issue is that it is an array not an object, so its throwing the error.

    So are these bugs already in the package? Or if not that what possible causes it could be with my project? As far as I know I have done all the configuration correctly as mentioned in the documentation.

    Thanks, Parth vora

    help wanted 
    opened by parth-vora-7 18
  • Branch 2.2 Selects random user if no email given

    Branch 2.2 Selects random user if no email given

    I'm on 2.2 due to the version of laravel I'm using. This may not be a problem in other branches, but I'm raising it while I remember, and will add further details when I can.

    I updated a site that was using 2.x and it seems that the email on the verification URL is a new requirement, which my verification email template did not include. Tracing through the code (since users were all getting "verification has failed" errors), a user was selected from the database. However, it was not the correct user - it was just the first user that came out of the users table. This was of course failing the verification since that was not the user being verified, but the fact that it got that user means the reason for failure can be misleading.

    Instead, if no email is given in the verification URL, the verification process should realise that earlier, not go and fetch a user with the missing email address, and go down the "user not found" path.

    I don't believe this is a security issue, but just the fact that it is possible for the verification process to be even looking at the wrong user could lead to unexpected consequences.

    opened by judgej 17
  • User Verification with Spark?

    User Verification with Spark?

    Any success or how-to's leveraging this great package with Laravel 5.4 and Spark? Spark's registration process adds quite a bit of twists to the standard Laravel install, but I'd love to not have to write user email verification from scratch and use this package if possible.

    enhancement 
    opened by gstoa 16
  • Reflection Exception when using UserVerification::generate($user)

    Reflection Exception when using UserVerification::generate($user)

    Hello,

    I followed the documentation step by step but I'm getting this error and can't find any solution to fix it: ReflectionException in Container.php line 749: Class user.verification does not exist

    Do you know how can I fix this?

    help wanted 
    opened by JosephELKHOURY 15
  • Provide resend route

    Provide resend route

    Hey @jrean,

    this PR for #51 is not completely done yet, but maybe you can already test it in any case.

    Concerns / todos:

    • b/c break for people who rely on the routes from the package to the RegisterController
    • Controller needs to be publishable & overwritable to customize things like redirectIfVerified (publish not implemented, overwrite not tested yet)
      • this should be moved to a config file though

    Discussion

    • Are you fine with doing a redirect back(); which might include an error flash message? Should we namespace the flash message? Like user-verification-error.
    • I implemented it using a post with a user_id which makes sense for me, as it is a kind of post action and this allows us to use the resend route also for e.g. for an admin resending a link to a user by triggering a post request with another users user_id
    opened by lukasoppermann 12
  • verification_token not saving

    verification_token not saving

    I have a weird issue I'm struggling to debug why the verification_token isn't being saved to the database. It is getting created and emailed correctly. Also if I manually add it everything works fine.

    Here is my user model, pretty basic:

    <?php
    
    namespace App;
    
    use Illuminate\Notifications\Notifiable;
    use Illuminate\Foundation\Auth\User as Authenticatable;
    
    use App\Models;
    
    class User extends Authenticatable
    {
        use Notifiable;
    
        protected $table = 'users';
        public $incrementing = false;
        public $timestamps = true;
    
        /**
         * The attributes that are mass assignable.
         *
         * @var array
         */
        protected $fillable = [
            'name', 'email', 'password', 'uuid', 'verification_token',
            'remember_token', 'created_at', 'updated_at', 'legacy_verified',
            'verified',
        ];
    
        /**
         * The attributes that should be hidden for arrays.
         *
         * @var array
         */
        protected $hidden = [
            'password', 'remember_token',
        ];
    }
    

    and my registration controller;

    <?php
    namespace App\Http\Controllers\Auth;
    
    use App\User;
    use Validator;
    use App\Http\Controllers\Controller;
    use Illuminate\Foundation\Auth\RegistersUsers;
    use Illuminate\Http\Request;
    
    use Jrean\UserVerification\Traits\VerifiesUsers;
    use Jrean\UserVerification\Facades\UserVerification as UserVerification;
    use Jrean\UserVerification\Events\VerificationEmailSent;
    
    class RegisterController extends Controller
    {
        use RegistersUsers, VerifiesUsers;
    
        protected $data = []; // the information we send to the view
    
        /**
         * Where to redirect users after login / registration.
         *
         * @var string
         */
        protected $redirectTo = 'user/registered';
    
        protected $redirectIfVerified = '/user/signin';
    
        protected $redirectAfterVerification = '/user/signin';
    
        //protected $verificationErrorView = '';
        //protected $verificationEmailView = '';
    
        /**
         * Create a new controller instance.
         *
         * @return void
         */
        public function __construct()
        {
             $this->middleware('guest', [
                'except' => ['getVerification', 'getVerificationError']
             ]);
        }
    
        /**
         * Get a validator for an incoming registration request.
         *
         * @param array $data
         *
         * @return \Illuminate\Contracts\Validation\Validator
         */
        protected function validator(array $data)
        {
            return Validator::make($data, [
                'email'    => 'required|email|max:255|unique:users',
                'password' => 'required|min:8|confirmed',
            ]);
        }
    
        /**
         * Create a new user instance after a valid registration.
         *
         * @param array $data
         *
         * @return User
         */
        protected function create(array $data)
        {
            $user = new \App\User();
    
            return $user->create([
                'email'    => $data['email'],
                'password' => bcrypt($data['password']),
                'uuid'     => \Uuid::generate(4),
            ]);
        }
    
        /**
         * Handle a registration request for the application.
         *
         * @param  \Illuminate\Http\Request  $request
         * @return \Illuminate\Http\Response
         */
        public function register(Request $request)
        {
            $this->validator($request->all())->validate();
    
            $user = $this->create($request->all());
            $this->guard()->login($user);
    
            UserVerification::generate($user);
            //UserVerification::send($user, 'Verify Your Account');
    
            $token = $user->verification_token . '?email=' . urlencode($user->email);
    
            // @FIXME: Clean this up
            \Mail::send('mail.empty', [], function (\Illuminate\Mail\Message $message) use ($user, $token) {
                $message
                ->to($user->email, $user->email)
                ->embedData([
                    'subject' => 'Verify',
                    'template_id' => '6620a3f6-66df-4a42-9d4b-5bae3d974648',
                    'categories' => ['unverified'],
                    'personalizations' => [
                        [
                            'substitutions' => [
                                '%name%' => '',
                                '%verification_code%' => url('user/verify') . '/' . $token,
                                '%user_reference_id%' => strtoupper($user->uuid),
                            ],
                        ],
                    ],
                    // Unsubscribed users will want this
                    'mail_settings' => [
                        'bypass_list_management' => [
                            'enable' => true,
                        ],
                    ],
                    // To reduce the potential of being marked as spam we need
                    // to disable tracking.
                    'tracking_settings' => [
                        'click_tracking' => [
                            'enable' => false,
                        ],
                        'subscription_tracking' => [
                            'enable' => false,
                        ],
                        'ganalytics' => [
                            'enable' => false,
                        ],
                    ],
                ], 'sendgrid/x-smtpapi');
            });
    
            if($request->ajax()) {
                return response()->json([
                    'result'  => 'success',
                    'message' => trans('user.registered_dropdown'),
                    'html'    => null,
                ], 200);
            }
            else {
                return redirect($this->redirectPath());
            }
        }
    }
    

    No exceptions and everything else works.

    help wanted 
    opened by gibbs 11
  • redirectIfVerified not been applied?

    redirectIfVerified not been applied?

    Error; Trait method redirectIfVerified has not been applied, because there are collisions with other trait methods on App\Http\Controllers\Auth\AuthController

    I have this code:

    <?php
    
    namespace App\Http\Controllers\Auth;
    
    use App\User;
    use Validator;
    use App\Http\Controllers\Controller;
    use Illuminate\Foundation\Auth\ThrottlesLogins;
    use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
    
    use Jrean\UserVerification\Traits\VerifiesUsers;
    use Jrean\UserVerification\Traits\RedirectsUsers;
    
    use UserVerification;
    use Auth;
    use Carbon\Carbon;
    
    class AuthController extends Controller
    {
        /*
        |--------------------------------------------------------------------------
        | Registration & Login Controller
        |--------------------------------------------------------------------------
        |
        | This controller handles the registration of new users, as well as the
        | authentication of existing users. By default, this controller uses
        | a simple trait to add these behaviors. Why don't you explore it?
        |
        */
    
        use AuthenticatesAndRegistersUsers, ThrottlesLogins, VerifiesUsers, RedirectsUsers;
    
    
        /**
         * Where to redirect users after login / registration.
         *
         * @var string
         */
        protected $redirectTo = '/';
        protected $redirectIfVerified = '/';
    
    
    help wanted 
    opened by renege 11
  • Jrean\UserVerification\Traits\UserVerification

    Jrean\UserVerification\Traits\UserVerification

    If I add UserVerification trait to the User model I start getting:

    Symfony\Component\Debug\Exception\FatalErrorException: Cannot use Jrean\UserVerification\Facades\UserVerification as UserVerification because the name is already in use in /my_project/vendor/jrean/laravel-user-verification/src/Traits/VerifiesUsers.php:11

    Without the Jrean\UserVerification\Traits\UserVerification trait in the User model it works when I access any route.

    Is anybody else getting this?

    help wanted 
    opened by borutjures 10
  • support users in a different db connection

    support users in a different db connection

    https://github.com/jrean/laravel-user-verification/blob/69527fdd760cdd29853846e03504b567aac58c8a/src/UserVerification.php#L271

    https://github.com/jrean/laravel-user-verification/blob/69527fdd760cdd29853846e03504b567aac58c8a/src/UserVerification.php#L342

    The above two places make it almost impossible to use a different connection than the default(actually it is possible to get around it by changing DB facade temporarily, but it's not the right way), so i would suggest changing the second constructor parameter to $connection,

    1. then at places where it needs schema, just do $connection->getSchemaBuilder(),
    2. and replace DB with $connections in the above places.
    3. And of course, you need to modify the service provider slightly as well. I would create a PR if you want it.
    opened by deyikong 0
  • Not working for multiple guards

    Not working for multiple guards

    Hi, I have 3 personas who are authenticable. I discovered that UserVerification class on line 52 kept getting model from the auth.providers.users.model. I need it it to validate against the customer provider not users. How do I go about this?

    opened by salvationarinze 0
  • Customizable column names

    Customizable column names

    Hi, Beautiful piece of work. I wish to request that the "verified" and "verification_token" column names be customizable based on info supplied on the published config file because currently working on a solution that required the phone number to be verified. I would have preferred an "email_verified" column name to differentiate them both

    opened by salvationarinze 0
Releases(v10.0.0)
Owner
Jean Ragouin
Learning is a Gift, Sharing is a Duty
Jean Ragouin
Kaiju is an open source verification bot based on Discord's OAuth written in C# and PHP, with the functionality of being able to integrate the user to a new server in case yours is suspended.

What is Kaiju? Kaiju is an open source verification bot for Discord servers, based on OAuth and with permission for the server owner, to be able to mi

in the space 10 Nov 20, 2022
PHP library to verify and validate Apple IdentityToken and authenticate a user with Apple ID.

Sign-in with Apple SDK Installation Recommended and easiest way to installing library is through Composer. composer require azimolabs/apple-sign-in-ph

Azimo Labs 79 Nov 8, 2022
Handle roles and permissions in your Laravel application

Laratrust (Laravel Package) Version Compatibility Laravel Laratrust 8.x 6.x 7.x 6.x 6.x 6.x 5.6.x - 5.8.x 5.2 5.3.x - 5.5.x 5.1 5.0.x - 5.2.x 4.0. Ins

Santiago García 2k Dec 30, 2022
UserFrosting is a secure, modern user management system written in PHP and built on top of the Slim Microframework, Twig templating engine, and Eloquent ORM.

UserFrosting is a secure, modern user management system written in PHP and built on top of the Slim Microframework, Twig templating engine, and Eloquent ORM.

UserFrosting 1.6k Jan 1, 2023
Auth is a module for the Yii PHP framework that provides a web user interface for Yii's built-in authorization manager

Auth is a module for the Yii PHP framework that provides a web user interface for Yii's built-in authorization manager (CAuthManager). You can read more about Yii's authorization manager in the framework documentation under Authentication and Authorization.

Christoffer Niska 134 Oct 22, 2022
Laravel package to easily login as other users during development.

A Laravel 5.4 utility package to enable developers to log in as other users during development. Installation To install the package, simply follow the

VIA Creative 555 Jan 8, 2023
PermissionsMakr is a Laravel package that will help any developer to easily manage the system's users permissions

PermissionsMakr is a Laravel package that will help any developer to easily manage the system's users permissions

Alvarium Digital 3 Nov 30, 2021
User role and Permission Management system with Paticie package

User role and Permission Management system with Paticie package Installation instruction Download or git clone https://github.com/KKOO727/User-role-ma

Ninja 2 Mar 4, 2022
Tech-Admin is Laravel + Bootstrap Admin Panel With User Management And Access Control based on Roles and Permissions.

Tech-Admin | Laravel 8 + Bootstrap 4 Tech-Admin is Admin Panel With Preset of Roles, Permissions, ACL, User Management, Profile Management. Features M

TechTool India 39 Dec 23, 2022
User registration and login form with validations and escapes for total security made with PHP.

Login and Sign Up with PHP User registration and login form with validations and escapes for total security made with PHP. Validations Required fields

Alexander Pérez 2 Jan 26, 2022
:octocat: Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, you can easily use it without Laravel.

Socialite Socialite is an OAuth2 Authentication tool. It is inspired by laravel/socialite, You can easily use it in any PHP project. 中文文档 This tool no

安正超 1.2k Dec 22, 2022
this is a semester project using Laravel, this app allow user to keep and shear their note with other users.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Vichhagar Nhin 0 Dec 24, 2021
A Laravel 5 package for OAuth Social Login/Register implementation using Laravel socialite and (optionally) AdminLTE Laravel package

laravel-social A Laravel 5 package for OAuth Social Login/Register implementation using Laravel socialite and (optionally) AdminLTE Laravel package. I

Sergi Tur Badenas 42 Nov 29, 2022
Easily define tokens and options that can be replaced in strings.

Token Replace This simple package allows you to define tokens that can be replaced in strings. Instead of a simple str_replace, Token Replace lets you

Jamie Holly 2 Dec 21, 2022
phpCAS is an authentication library that allows PHP applications to easily authenticate users via a Central Authentication Service (CAS) server.

phpCAS is an authentication library that allows PHP applications to easily authenticate users via a Central Authentication Service (CAS) server.

Apereo Foundation 780 Dec 24, 2022
PHPAuth is a secure PHP Authentication class that easily integrates into any site.

PHPAuth is under going a complete rewrite to bring the code up to date, the project has been on hold for way to long time now and I decided to work on it again making sure EVERYONE can use it and not just advanced programmers.

PHPAuth 855 Jan 3, 2023
Fausse page de connexion faite en PHP, inclu: blacklist IP, redirection au choix, webhook discord, logs. Pour les informations: IP, mdp, email, géolocalisation, navigateur et bien d'autre

Page de phishing pour facebook 1. Informations Page de phishing simulant la page de connexion PayPal. Faite en php, elle fournit: email mot de passe I

Esio_dev 10 Dec 5, 2022
Armor - User and Session Management

User and session management. Provides solid base foundation for development of custom user management system.

Matt Dizak 3 Apr 13, 2022
Helps you securely setup a master password and login into user accounts with it.

?? Make your Login form smart in a minute! Built with ❤️ for every smart laravel developer Helps you set a master password in .env file and login into

Iman 341 Jan 1, 2023