Skip to content

Commit 583796d

Browse files
committed
First auth tests around profile
0 parents  commit 583796d

File tree

129 files changed

+239714
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+239714
-0
lines changed

.env.example

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
LOG_LEVEL=debug
9+
10+
DB_CONNECTION=mysql
11+
DB_HOST=127.0.0.1
12+
DB_PORT=3306
13+
DB_DATABASE=laravel
14+
DB_USERNAME=root
15+
DB_PASSWORD=
16+
17+
BROADCAST_DRIVER=log
18+
CACHE_DRIVER=file
19+
FILESYSTEM_DRIVER=local
20+
QUEUE_CONNECTION=sync
21+
SESSION_DRIVER=file
22+
SESSION_LIFETIME=120
23+
24+
MEMCACHED_HOST=127.0.0.1
25+
26+
REDIS_HOST=127.0.0.1
27+
REDIS_PASSWORD=null
28+
REDIS_PORT=6379
29+
30+
MAIL_MAILER=smtp
31+
MAIL_HOST=mailhog
32+
MAIL_PORT=1025
33+
MAIL_USERNAME=null
34+
MAIL_PASSWORD=null
35+
MAIL_ENCRYPTION=null
36+
MAIL_FROM_ADDRESS=null
37+
MAIL_FROM_NAME="${APP_NAME}"
38+
39+
AWS_ACCESS_KEY_ID=
40+
AWS_SECRET_ACCESS_KEY=
41+
AWS_DEFAULT_REGION=us-east-1
42+
AWS_BUCKET=
43+
AWS_USE_PATH_STYLE_ENDPOINT=false
44+
45+
PUSHER_APP_ID=
46+
PUSHER_APP_KEY=
47+
PUSHER_APP_SECRET=
48+
PUSHER_APP_CLUSTER=mt1
49+
50+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
51+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
*.js linguist-vendored
5+
CHANGELOG.md export-ignore

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
.env
7+
.env.backup
8+
.phpunit.result.cache
9+
docker-compose.override.yml
10+
Homestead.json
11+
Homestead.yaml
12+
npm-debug.log
13+
yarn-error.log
14+
/.idea
15+
/.vscode

.styleci.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
php:
2+
preset: laravel
3+
version: 8
4+
disabled:
5+
- no_unused_imports
6+
finder:
7+
not-name:
8+
- index.php
9+
- server.php
10+
js:
11+
finder:
12+
not-name:
13+
- webpack.mix.js
14+
css: true

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## Laravel Breeze: Tailwind Pages Skeleton
2+
3+
Laravel boilerplate repository to create simple demo-projects. It allows to quickly add new routes/pages, and has examples of a table page, and a form page.
4+
5+
It uses the Starter Kit [Laravel Breeze](https://github.com/laravel/breeze) based on Tailwind framework.
6+
7+
![Laravel Breeze Table page](https://laraveldaily.com/wp-content/uploads/2021/09/Screenshot-2021-09-19-at-09.51.38.png)
8+
9+
![Laravel Breeze Form page](https://laraveldaily.com/wp-content/uploads/2021/09/Screenshot-2021-09-19-at-09.51.50.png)
10+
11+
-----
12+
13+
### How to use
14+
15+
- Clone the project with `git clone`
16+
- Copy `.env.example` file to `.env` and edit database credentials there
17+
- Run `composer install`
18+
- Run `php artisan key:generate`
19+
- Run `php artisan migrate --seed` (it has some seeded data for your testing)
20+
- That's it: launch the main URL
21+
22+
23+
---
24+
25+
## More from our LaravelDaily Team
26+
27+
- Enroll in our [Laravel Online Courses](https://laraveldaily.teachable.com/)
28+
- Check out our adminpanel generator [QuickAdminPanel](https://quickadminpanel.com)
29+
- Purchase our [Livewire Kit](https://livewirekit.com)
30+
- Subscribe to our [YouTube channel Laravel Daily](https://www.youtube.com/channel/UCTuplgOBi6tJIlesIboymGA)

app/Console/Kernel.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
//
17+
];
18+
19+
/**
20+
* Define the application's command schedule.
21+
*
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23+
* @return void
24+
*/
25+
protected function schedule(Schedule $schedule)
26+
{
27+
// $schedule->command('inspire')->hourly();
28+
}
29+
30+
/**
31+
* Register the commands for the application.
32+
*
33+
* @return void
34+
*/
35+
protected function commands()
36+
{
37+
$this->load(__DIR__.'/Commands');
38+
39+
require base_path('routes/console.php');
40+
}
41+
}

app/Exceptions/Handler.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
use Throwable;
7+
8+
class Handler extends ExceptionHandler
9+
{
10+
/**
11+
* A list of the exception types that are not reported.
12+
*
13+
* @var array
14+
*/
15+
protected $dontReport = [
16+
//
17+
];
18+
19+
/**
20+
* A list of the inputs that are never flashed for validation exceptions.
21+
*
22+
* @var array
23+
*/
24+
protected $dontFlash = [
25+
'current_password',
26+
'password',
27+
'password_confirmation',
28+
];
29+
30+
/**
31+
* Register the exception handling callbacks for the application.
32+
*
33+
* @return void
34+
*/
35+
public function register()
36+
{
37+
$this->reportable(function (Throwable $e) {
38+
//
39+
});
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Http\Requests\Auth\LoginRequest;
7+
use App\Providers\RouteServiceProvider;
8+
use Illuminate\Http\Request;
9+
use Illuminate\Support\Facades\Auth;
10+
11+
class AuthenticatedSessionController extends Controller
12+
{
13+
/**
14+
* Display the login view.
15+
*
16+
* @return \Illuminate\View\View
17+
*/
18+
public function create()
19+
{
20+
return view('auth.login');
21+
}
22+
23+
/**
24+
* Handle an incoming authentication request.
25+
*
26+
* @param \App\Http\Requests\Auth\LoginRequest $request
27+
* @return \Illuminate\Http\RedirectResponse
28+
*/
29+
public function store(LoginRequest $request)
30+
{
31+
$request->authenticate();
32+
33+
$request->session()->regenerate();
34+
35+
return redirect()->intended(RouteServiceProvider::HOME);
36+
}
37+
38+
/**
39+
* Destroy an authenticated session.
40+
*
41+
* @param \Illuminate\Http\Request $request
42+
* @return \Illuminate\Http\RedirectResponse
43+
*/
44+
public function destroy(Request $request)
45+
{
46+
Auth::guard('web')->logout();
47+
48+
$request->session()->invalidate();
49+
50+
$request->session()->regenerateToken();
51+
52+
return redirect('/');
53+
}
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Http\Request;
8+
use Illuminate\Support\Facades\Auth;
9+
use Illuminate\Validation\ValidationException;
10+
11+
class ConfirmablePasswordController extends Controller
12+
{
13+
/**
14+
* Show the confirm password view.
15+
*
16+
* @return \Illuminate\View\View
17+
*/
18+
public function show()
19+
{
20+
return view('auth.confirm-password');
21+
}
22+
23+
/**
24+
* Confirm the user's password.
25+
*
26+
* @param \Illuminate\Http\Request $request
27+
* @return mixed
28+
*/
29+
public function store(Request $request)
30+
{
31+
if (! Auth::guard('web')->validate([
32+
'email' => $request->user()->email,
33+
'password' => $request->password,
34+
])) {
35+
throw ValidationException::withMessages([
36+
'password' => __('auth.password'),
37+
]);
38+
}
39+
40+
$request->session()->put('auth.password_confirmed_at', time());
41+
42+
return redirect()->intended(RouteServiceProvider::HOME);
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Http\Request;
8+
9+
class EmailVerificationNotificationController extends Controller
10+
{
11+
/**
12+
* Send a new email verification notification.
13+
*
14+
* @param \Illuminate\Http\Request $request
15+
* @return \Illuminate\Http\RedirectResponse
16+
*/
17+
public function store(Request $request)
18+
{
19+
if ($request->user()->hasVerifiedEmail()) {
20+
return redirect()->intended(RouteServiceProvider::HOME);
21+
}
22+
23+
$request->user()->sendEmailVerificationNotification();
24+
25+
return back()->with('status', 'verification-link-sent');
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Providers\RouteServiceProvider;
7+
use Illuminate\Http\Request;
8+
9+
class EmailVerificationPromptController extends Controller
10+
{
11+
/**
12+
* Display the email verification prompt.
13+
*
14+
* @param \Illuminate\Http\Request $request
15+
* @return mixed
16+
*/
17+
public function __invoke(Request $request)
18+
{
19+
return $request->user()->hasVerifiedEmail()
20+
? redirect()->intended(RouteServiceProvider::HOME)
21+
: view('auth.verify-email');
22+
}
23+
}

0 commit comments

Comments
 (0)