-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68c756f
commit 6f07584
Showing
13 changed files
with
556 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
namespace Illuminate\Auth\Console; | ||
|
||
use Illuminate\Console\Command; | ||
|
||
class MakeAuthCommand extends Command | ||
{ | ||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'make:auth'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Scaffold basic login and registration views and routes'; | ||
|
||
/** | ||
* THe views that need to be exported. | ||
* | ||
* @var array | ||
*/ | ||
protected $views = [ | ||
'auth/login.stub' => 'auth/login.blade.php', | ||
'auth/register.stub' => 'auth/register.blade.php', | ||
'auth/passwords/email.stub' => 'auth/passwords/email.blade.php', | ||
'auth/passwords/reset.stub' => 'auth/passwords/reset.blade.php', | ||
'auth/emails/password.stub' => 'auth/emails/password.blade.php', | ||
'layouts/app.stub' => 'layouts/app.blade.php', | ||
'home.stub' => 'home.blade.php', | ||
'welcome.stub' => 'welcome.blade.php', | ||
]; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return void | ||
*/ | ||
public function fire() | ||
{ | ||
$this->createDirectories(); | ||
|
||
$this->exportViews(); | ||
|
||
$this->info('Installed HomeController.'); | ||
|
||
copy(__DIR__.'/stubs/make/controllers/HomeController.stub', app_path('Http/Controllers/HomeController.php')); | ||
|
||
$this->info('Updated Routes File.'); | ||
|
||
copy(__DIR__.'/stubs/make/routes.stub', app_path('Http/routes.php')); | ||
|
||
$this->comment('Authentication scaffolding generated successfully!'); | ||
} | ||
|
||
/** | ||
* Create the directories for the files. | ||
* | ||
* @return void | ||
*/ | ||
protected function createDirectories() | ||
{ | ||
if (! is_dir(base_path('resources/views/layouts'))) { | ||
mkdir(base_path('resources/views/layouts'), 0755, true); | ||
} | ||
|
||
if (! is_dir(base_path('resources/views/auth/passwords'))) { | ||
mkdir(base_path('resources/views/auth/passwords'), 0755, true); | ||
} | ||
|
||
if (! is_dir(base_path('resources/views/auth/emails'))) { | ||
mkdir(base_path('resources/views/auth/emails'), 0755, true); | ||
} | ||
} | ||
|
||
/** | ||
* Export the authentication views. | ||
* | ||
* @return void | ||
*/ | ||
protected function exportViews() | ||
{ | ||
foreach ($this->views as $key => $value) { | ||
$path = base_path('resources/views/'.$value); | ||
|
||
$this->line('<info>Created View:</info> '.$path); | ||
|
||
copy(__DIR__.'/stubs/make/views/'.$key, $path); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/Illuminate/Auth/Console/stubs/make/controllers/HomeController.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
use App\Http\Requests; | ||
use App\Http\Controllers\Controller; | ||
|
||
class HomeController extends Controller | ||
{ | ||
/** | ||
* Create a new controller instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->middleware('auth'); | ||
} | ||
|
||
/** | ||
* Show the application dashboard. | ||
* | ||
* @return Resposne | ||
*/ | ||
public function index() | ||
{ | ||
return view('home'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Application Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here is where you can register all of the routes in an application. | ||
| It's a breeze. Simply tell Laravel the URIs it should respond to | ||
| and give it the controller to call when that URI is requested. | ||
| | ||
*/ | ||
|
||
Route::get('/', function () { | ||
return view('welcome'); | ||
}); | ||
|
||
/* | ||
| This route group applies the "web" middleware group to every route | ||
| it contains. The "web" middleware group is defined in your HTTP | ||
| kernel and includes session state, CSRF protection, and more. | ||
*/ | ||
|
||
Route::group(['middleware' => 'web'], function () { | ||
Route::auth(); | ||
|
||
Route::get('/home', 'HomeController@index'); | ||
}); | ||
|
1 change: 1 addition & 0 deletions
1
src/Illuminate/Auth/Console/stubs/make/views/auth/emails/password.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Click here to reset your password: {{ url('password/reset/'.$token) }} |
66 changes: 66 additions & 0 deletions
66
src/Illuminate/Auth/Console/stubs/make/views/auth/login.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-8 col-md-offset-2"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading">Login</div> | ||
<div class="panel-body"> | ||
<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}"> | ||
{!! csrf_field() !!} | ||
|
||
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> | ||
<label class="col-md-4 control-label">E-Mail Address</label> | ||
|
||
<div class="col-md-6"> | ||
<input type="email" class="form-control" name="email" value="{{ old('email') }}"> | ||
|
||
@if ($errors->has('email')) | ||
<span class="help-block"> | ||
<strong>{{ $errors->first('email') }}</strong> | ||
</span> | ||
@endif | ||
</div> | ||
</div> | ||
|
||
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}"> | ||
<label class="col-md-4 control-label">Password</label> | ||
|
||
<div class="col-md-6"> | ||
<input type="password" class="form-control" name="password"> | ||
|
||
@if ($errors->has('password')) | ||
<span class="help-block"> | ||
<strong>{{ $errors->first('password') }}</strong> | ||
</span> | ||
@endif | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<div class="col-md-6 col-md-offset-4"> | ||
<div class="checkbox"> | ||
<label> | ||
<input type="checkbox" name="remember"> Remember Me | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<div class="col-md-6 col-md-offset-4"> | ||
<button type="submit" class="btn btn-primary"> | ||
<i class="fa fa-btn fa-sign-in"></i>Login | ||
</button> | ||
|
||
<a class="btn btn-link" href="{{ url('/password/reset') }}">Forgot Your Password?</a> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
@endsection |
47 changes: 47 additions & 0 deletions
47
src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/email.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@extends('layouts.app') | ||
|
||
<!-- Main Content --> | ||
@section('content') | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-8 col-md-offset-2"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading">Reset Password</div> | ||
<div class="panel-body"> | ||
@if (session('status')) | ||
<div class="alert alert-success"> | ||
{{ session('status') }} | ||
</div> | ||
@endif | ||
|
||
<form class="form-horizontal" role="form" method="POST" action="{{ url('/password/email') }}"> | ||
{!! csrf_field() !!} | ||
|
||
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> | ||
<label class="col-md-4 control-label">E-Mail Address</label> | ||
|
||
<div class="col-md-6"> | ||
<input type="email" class="form-control" name="email" value="{{ old('email') }}"> | ||
|
||
@if ($errors->has('email')) | ||
<span class="help-block"> | ||
<strong>{{ $errors->first('email') }}</strong> | ||
</span> | ||
@endif | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<div class="col-md-6 col-md-offset-4"> | ||
<button type="submit" class="btn btn-primary"> | ||
<i class="fa fa-btn fa-envelope"></i>Send Password Reset Link | ||
</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
@endsection |
70 changes: 70 additions & 0 deletions
70
src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/reset.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-md-8 col-md-offset-2"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading">Reset Password</div> | ||
|
||
<div class="panel-body"> | ||
<form class="form-horizontal" role="form" method="POST" action="{{ url('/password/reset') }}"> | ||
{!! csrf_field() !!} | ||
|
||
<input type="hidden" name="token" value="{{ $token }}"> | ||
|
||
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> | ||
<label class="col-md-4 control-label">E-Mail Address</label> | ||
|
||
<div class="col-md-6"> | ||
<input type="email" class="form-control" name="email" value="{{ old('email') }}"> | ||
|
||
@if ($errors->has('email')) | ||
<span class="help-block"> | ||
<strong>{{ $errors->first('email') }}</strong> | ||
</span> | ||
@endif | ||
</div> | ||
</div> | ||
|
||
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}"> | ||
<label class="col-md-4 control-label">Password</label> | ||
|
||
<div class="col-md-6"> | ||
<input type="password" class="form-control" name="password"> | ||
|
||
@if ($errors->has('password')) | ||
<span class="help-block"> | ||
<strong>{{ $errors->first('password') }}</strong> | ||
</span> | ||
@endif | ||
</div> | ||
</div> | ||
|
||
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}"> | ||
<label class="col-md-4 control-label">Confirm Password</label> | ||
<div class="col-md-6"> | ||
<input type="password" class="form-control" name="password_confirmation"> | ||
|
||
@if ($errors->has('password_confirmation')) | ||
<span class="help-block"> | ||
<strong>{{ $errors->first('password_confirmation') }}</strong> | ||
</span> | ||
@endif | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<div class="col-md-6 col-md-offset-4"> | ||
<button type="submit" class="btn btn-primary"> | ||
<i class="fa fa-btn fa-refresh"></i>Reset Password | ||
</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
@endsection |
Oops, something went wrong.