Skip to content

Commit

Permalink
work on auth scaffolding updates
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 21, 2019
1 parent 31610cb commit 6aa7623
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion api-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Once the migration has been created, run the `migrate` Artisan command.
<a name="generating-tokens"></a>
## Generating Tokens

Once the `api_token` column has been added to your `users` table, you are ready to assign random API tokens to each user that registers with your application. You should assign these tokens when a `User` model is created for the user during registration. When using the [authentication scaffolding](/docs/{{version}}/authentication#authentication-quickstart) provided by the `make:auth` Artisan command, this may be done in the `create` method of the `RegisterController`:
Once the `api_token` column has been added to your `users` table, you are ready to assign random API tokens to each user that registers with your application. You should assign these tokens when a `User` model is created for the user during registration. When using the [authentication scaffolding](/docs/{{version}}/authentication#authentication-quickstart) provided by the `laravel/ui` Composer package, this may be done in the `create` method of the `RegisterController`:

use Illuminate\Support\Str;
use Illuminate\Support\Facades\Hash;
Expand Down
12 changes: 7 additions & 5 deletions authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<a name="introduction"></a>
## Introduction

> {tip} **Want to get started fast?** Just run `php artisan make:auth` and `php artisan migrate` in a fresh Laravel application. Then, navigate your browser to `http://your-app.test/register` or any other URL that is assigned to your application. These two commands will take care of scaffolding your entire authentication system!
> {tip} **Want to get started fast?** Install the `laravel/ui` Composer package and run `php artisan ui vue --auth` in a fresh Laravel application. After migrating your database, navigate your browser to `http://your-app.test/register` or any other URL that is assigned to your application. These commands will take care of scaffolding your entire authentication system!
Laravel makes implementing authentication very simple. In fact, almost everything is configured for you out of the box. The authentication configuration file is located at `config/auth.php`, which contains several well documented options for tweaking the behavior of the authentication services.

Expand All @@ -54,9 +54,11 @@ Laravel ships with several pre-built authentication controllers, which are locat
<a name="included-routing"></a>
### Routing

Laravel provides a quick way to scaffold all of the routes and views you need for authentication using one simple command:
Laravel's `laravel/ui` package provides a quick way to scaffold all of the routes and views you need for authentication using a few simple commands:

php artisan make:auth
composer require laravel/ui

php artisan ui vue --auth

This command should be used on fresh applications and will install a layout view, registration and login views, as well as routes for all authentication end-points. A `HomeController` will also be generated to handle post-login requests to your application's dashboard.

Expand All @@ -65,9 +67,9 @@ This command should be used on fresh applications and will install a layout view
<a name="included-views"></a>
### Views

As mentioned in the previous section, the `php artisan make:auth` command will create all of the views you need for authentication and place them in the `resources/views/auth` directory.
As mentioned in the previous section, the `laravel/ui` package's `php artisan ui vue --auth` command will create all of the views you need for authentication and place them in the `resources/views/auth` directory.

The `make:auth` command will also create a `resources/views/layouts` directory containing a base layout for your application. All of these views use the Bootstrap CSS framework, but you are free to customize them however you wish.
The `ui` command will also create a `resources/views/layouts` directory containing a base layout for your application. All of these views use the Bootstrap CSS framework, but you are free to customize them however you wish.

<a name="included-authenticating"></a>
### Authenticating
Expand Down
2 changes: 0 additions & 2 deletions dusk.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ To get started, let's write a test that verifies we can log into our application

As you can see in the example above, the `browse` method accepts a callback. A browser instance will automatically be passed to this callback by Dusk and is the main object used to interact with and make assertions against your application.

> {tip} This test can be used to test the login screen generated by the `make:auth` Artisan command.
#### Creating Multiple Browsers

Sometimes you may need multiple browsers in order to properly carry out a test. For example, multiple browsers may be needed to test a chat screen that interacts with websockets. To create multiple browsers, "ask" for more than one browser in the signature of the callback given to the `browse` method:
Expand Down
16 changes: 12 additions & 4 deletions passwords.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<a name="introduction"></a>
## Introduction

> {tip} **Want to get started fast?** Just run `php artisan make:auth` in a fresh Laravel application and navigate your browser to `http://your-app.test/register` or any other URL that is assigned to your application. This single command will take care of scaffolding your entire authentication system, including resetting passwords!
> {tip} **Want to get started fast?** Install the `laravel/ui` Composer package and run `php artisan ui vue --auth` in a fresh Laravel application. After migrating your database, navigate your browser to `http://your-app.test/register` or any other URL that is assigned to your application. This single command will take care of scaffolding your entire authentication system, including resetting passwords!
Most web applications provide a way for users to reset their forgotten passwords. Rather than forcing you to re-implement this on each application, Laravel provides convenient methods for sending password reminders and performing password resets.

Expand All @@ -30,14 +30,22 @@ Next, a table must be created to store the password reset tokens. The migration
<a name="resetting-routing"></a>
## Routing

Laravel includes `Auth\ForgotPasswordController` and `Auth\ResetPasswordController` classes that contains the logic necessary to e-mail password reset links and reset user passwords. All of the routes needed to perform password resets may be generated using the `make:auth` Artisan command:
Laravel includes `Auth\ForgotPasswordController` and `Auth\ResetPasswordController` classes that contains the logic necessary to e-mail password reset links and reset user passwords. All of the routes needed to perform password resets may be generated using the `laravel/ui` Composer package:

php artisan make:auth
composer require laravel/ui

php artisan ui vue --auth

<a name="resetting-views"></a>
## Views

Again, Laravel will generate all of the necessary views for password reset when the `make:auth` command is executed. These views are placed in `resources/views/auth/passwords`. You are free to customize them as needed for your application.
To generate all of the necessary view for resetting passwords, you may use the `laravel/ui` Composer package:

composer require laravel/ui

php artisan ui vue --auth

These views are placed in `resources/views/auth/passwords`. You are free to customize them as needed for your application.

<a name="after-resetting-passwords"></a>
## After Resetting Passwords
Expand Down
8 changes: 7 additions & 1 deletion verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ Laravel includes the `Auth\VerificationController` class that contains the neces
<a name="verification-views"></a>
## Views

Laravel will generate all of the necessary email verification views when the `make:auth` command is executed. This view is placed in `resources/views/auth/verify.blade.php`. You are free to customize this view as needed for your application.
To generate all of the necessary view for email verification, you may use the `laravel/ui` Composer package:

composer require laravel/ui

php artisan ui vue --auth

The email verification view is placed in `resources/views/auth/verify.blade.php`. You are free to customize this view as needed for your application.

<a name="after-verifying-emails"></a>
## After Verifying Emails
Expand Down

0 comments on commit 6aa7623

Please sign in to comment.