Add user verification on registration

This commit is contained in:
DariusIII
2018-06-20 09:31:44 +02:00
parent 10d1b529bf
commit 133daf4e36
7 changed files with 86 additions and 130 deletions
+1
View File
@@ -1,4 +1,5 @@
2018-06-20 DariusIII
* Chg: Add user verification on registration
* Chg: Add check if rating is set in Movie class updateMovieInfo function
2018-06-19 DariusIII
* Chg: Update imdbphp/imdbphp
@@ -6,12 +6,15 @@ use App\Models\User;
use App\Models\Settings;
use App\Models\UserRole;
use App\Models\Invitation;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\Request;
use Blacklight\utility\Utility;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Password;
use Illuminate\Foundation\Auth\RegistersUsers;
use Jrean\UserVerification\Facades\UserVerification;
use Jrean\UserVerification\Traits\VerifiesUsers;
class RegisterController extends Controller
{
@@ -28,6 +31,8 @@ class RegisterController extends Controller
use RegistersUsers;
use VerifiesUsers;
/**
* Where to redirect users after registration.
*
@@ -42,7 +47,7 @@ class RegisterController extends Controller
*/
public function __construct()
{
$this->middleware('guest');
$this->middleware('guest', ['except' => ['getVerification', 'getVerificationError']]);
}
/**
@@ -152,7 +157,7 @@ class RegisterController extends Controller
break;
}
$ret = $this->create(
$user = $this->create(
[
'username' => $userName,
'password' => $password,
@@ -164,11 +169,18 @@ class RegisterController extends Controller
]
);
if ($ret->id > 0) {
Auth::loginUsingId($ret->id);
event(new Registered($user));
UserVerification::generate($user);
UserVerification::send($user, 'User verification required');
if ($user->id > 0) {
Auth::loginUsingId($user->id);
User::updateSiteAccessed(Auth::id(), (int) Settings::settingValue('..storeuserips') === 1 ? $request->getClientIp() : '');
return redirect()->intended($this->redirectPath());
return $this->registered($request, $user)
?: redirect($this->redirectPath());
}
break;
case 'view': {
+1
View File
@@ -59,5 +59,6 @@ class Kernel extends HttpKernel
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'admin' => \App\Http\Middleware\IsAdmin::class,
'isVerified' => \Jrean\UserVerification\Middleware\IsVerified::class,
];
}
+1
View File
@@ -136,6 +136,7 @@
"intervention/imagecache": "^2.3",
"james-heinrich/getid3": "1.9.*",
"joshpinkney/tv-maze-php-api": "dev-master",
"jrean/laravel-user-verification": "^6.0",
"kevinlebrun/colors.php": "^1.0",
"laravel/framework": "5.6.*",
"laravel/scout": "^4.0",
Generated
+64 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "016d2121392c4c0ea3207cfb7252f6b9",
"content-hash": "1dcf6a9645d4d8cccaaed914b8bf0ba8",
"packages": [
{
"name": "adrenth/thetvdb2",
@@ -3266,6 +3266,69 @@
"description": "TVMaze-API-Wrapper",
"time": "2018-01-09T14:46:56+00:00"
},
{
"name": "jrean/laravel-user-verification",
"version": "v6.0.1",
"source": {
"type": "git",
"url": "https://github.com/jrean/laravel-user-verification.git",
"reference": "216ec2d003fa61092c129970d21b26b1774359f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jrean/laravel-user-verification/zipball/216ec2d003fa61092c129970d21b26b1774359f7",
"reference": "216ec2d003fa61092c129970d21b26b1774359f7",
"shasum": ""
},
"require": {
"illuminate/support": "5.6.*",
"php": ">=7.1.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^1.12",
"fzaninotto/faker": "^1.6",
"mockery/mockery": "^0.9.5",
"phpunit/phpunit": "^5.5",
"satooshi/php-coveralls": "^1.0",
"sllh/php-cs-fixer-styleci-bridge": "^2.1"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Jrean\\UserVerification\\UserVerificationServiceProvider"
],
"aliases": {
"UserVerification": "Jrean\\UserVerification\\Facades\\UserVerification"
}
}
},
"autoload": {
"psr-4": {
"Jrean\\UserVerification\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jean Ragouin",
"email": "go@askjong.com"
}
],
"description": "User Email Verification For Laravel 5.*",
"keywords": [
"email activation",
"email verification",
"framework",
"laravel",
"user activation",
"user verification"
],
"time": "2018-05-22T05:58:48+00:00"
},
{
"name": "kevinlebrun/colors.php",
"version": "1.0.3",
+2 -1
View File
@@ -158,6 +158,7 @@ return [
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
Jrean\UserVerification\UserVerificationServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\YencServiceProvider::class,
Way\Generators\GeneratorsServiceProvider::class,
@@ -214,7 +215,7 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'UserVerification' => Jrean\UserVerification\Facades\UserVerification::class,
],
];
-123
View File
@@ -1,123 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Root path where theme Views will be located.
| Can be outside default views path e.g.: resources/themes
| Leave it null if you will put your themes in the default views folder
| (as defined in config\views.php)
|--------------------------------------------------------------------------
*/
'themes_path' => 'resources/views/themes', // eg: base_path('resources/themes')
/*
|--------------------------------------------------------------------------
| Set behavior if an asset is not found in a Theme hierarchy.
| Available options: THROW_EXCEPTION | LOG_ERROR | IGNORE
|--------------------------------------------------------------------------
*/
'asset_not_found' => 'LOG_ERROR',
/*
|--------------------------------------------------------------------------
| Do we want a theme activated by default? Can be set at runtime with:
| Theme::set('theme-name');
|--------------------------------------------------------------------------
*/
'default' => 'Gentele',
/*
|--------------------------------------------------------------------------
| Cache theme.json configuration files that are located in each theme's folder
| in order to avoid searching theme settings in the filesystem for each request
|--------------------------------------------------------------------------
*/
'cache' => true,
/*
|--------------------------------------------------------------------------
| Define available themes. Format:
|
| 'theme-name' => [
| 'extends' => 'theme-to-extend', // optional
| 'views-path' => 'path-to-views', // defaults to: resources/views/theme-name
| 'asset-path' => 'path-to-assets', // defaults to: public/theme-name
|
| // You can add your own custom keys
| // Use Theme::getSetting('key') & Theme::setSetting('key', 'value') to access them
| 'key' => 'value',
| ],
|
|--------------------------------------------------------------------------
*/
'themes' => [
'Charisma' => [
'extends' => null,
'views-path' => 'resources/views/themes/Charisma',
'asset-path' => 'public/assets/Charisma',
],
'Gamma' => [
'extends' => null,
'views-path' => 'resources/views/themes/Gamma',
'asset-path' => 'public/assets/Gamma',
],
'Gentele' => [
'extends' => null,
'views-path' => 'resources/views/themes/Gentele',
'asset-path' => 'public/assets',
],
'Omicron' => [
'extends' => null,
'views-path' => 'resources/views/themes/Omicron',
'asset-path' => 'public/assets/Omicron',
],
'admin' => [
'extends' => null,
'views-path' => 'resources/views/themes/admin',
'asset-path' => 'public/assets',
],
// Add your themes here. These settings will override theme.json settings defined for each theme
/*
|---------------------------[ Example Structure ]--------------------------
|
| // Full theme Syntax:
|
| 'example1' => [
| 'extends' => null, // doesn't extend any theme
| 'views-path' => example, // = resources/views/example_theme
| 'asset-path' => example, // = public/example_theme
| ],
|
| // Use all Defaults:
|
| 'example2', // Assets =\public\example2, Views =\resources\views\example2
| // Note that if you use all default values, you can omit declaration completely.
| // i.e. defaults will be used when you call Theme::set('undefined-theme')
|
|
| // This theme shares the views with example2 but defines its own assets in \public\example3
|
| 'example3' => [
| 'views-path' => 'example',
| ],
|
| // This theme extends example1 and may override SOME views\assets in its own paths
|
| 'example4' => [
| 'extends' => 'example1',
| ],
|
|--------------------------------------------------------------------------
*/
],
];