mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:01:24 +00:00
Add UserServiceObserver and move account verification to it
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2019-02-07 DariusIII
|
||||
* Chg: Add UserServiceObserver and move account verification to it
|
||||
* Chg: Update package.json with new version of Vue (2.6.2)
|
||||
2019-02-06 DariusIII
|
||||
* Chg: Updated pear/console_getopt (v1.4.1 => v1.4.2)
|
||||
|
||||
@@ -11,12 +11,10 @@ use Illuminate\Http\Request;
|
||||
use Blacklight\utility\Utility;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Jrean\UserVerification\Traits\VerifiesUsers;
|
||||
use Jrean\UserVerification\Facades\UserVerification;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
@@ -82,7 +80,6 @@ class RegisterController extends Controller
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
* @throws \Jrean\UserVerification\Exceptions\ModelNotCompliantException
|
||||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
@@ -157,12 +154,6 @@ class RegisterController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
event(new Registered($user));
|
||||
|
||||
UserVerification::generate($user);
|
||||
|
||||
UserVerification::send($user, 'User email verification required');
|
||||
|
||||
return $this->registered($request, $user) ?: redirect($this->redirectPath());
|
||||
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\User;
|
||||
use Jrean\UserVerification\Facades\UserVerification;
|
||||
|
||||
class UserServiceObserver
|
||||
{
|
||||
/**
|
||||
* Handle the user "created" event.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*
|
||||
* @return void
|
||||
* @throws \Jrean\UserVerification\Exceptions\ModelNotCompliantException
|
||||
*/
|
||||
public function created(User $user)
|
||||
{
|
||||
UserVerification::generate($user);
|
||||
|
||||
UserVerification::send($user, 'User email verification required');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Observers\UserServiceObserver;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class UserServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
User::observe(UserServiceObserver::class);
|
||||
}
|
||||
}
|
||||
@@ -166,6 +166,7 @@ return [
|
||||
Xethron\MigrationsGenerator\MigrationsGeneratorServiceProvider::class,
|
||||
Orangehill\Iseed\IseedServiceProvider::class,
|
||||
Messerli90\IGDB\IGDBServiceProvider::class,
|
||||
App\Providers\UserServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
|
||||
Reference in New Issue
Block a user