Skip to content

Commit

Permalink
Change the name of the new config value, and associated method, to 'e…
Browse files Browse the repository at this point in the history
…mail' to match other apps and packages in the eco system.
  • Loading branch information
adear11 committed Sep 12, 2020
1 parent 128df4e commit 7dc23ed
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config/fortify.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'guard' => 'web',
'passwords' => 'users',
'username' => 'email',
'email_address' => 'email',
'email' => 'email',
'home' => '/home',
'limiters' => [
'login' => null,
Expand Down
4 changes: 2 additions & 2 deletions src/Fortify.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class Fortify
/**
* Get the name of the email address request variable.
*/
public static function emailAddress()
public static function email()
{
return config('fortify.email_address', 'email');
return config('fortify.email', 'email');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/NewPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public function store(Request $request): Responsable
{
$request->validate([
'token' => 'required',
Fortify::emailAddress() => 'required|email',
Fortify::email() => 'required|email',
]);

// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$status = $this->broker()->reset(
$request->only(Fortify::emailAddress(), 'password', 'password_confirmation', 'token'),
$request->only(Fortify::email(), 'password', 'password_confirmation', 'token'),
function ($user, $password) use ($request) {
app(ResetsUserPasswords::class)->reset($user, $request->all());

Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/PasswordResetLinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public function create(Request $request): RequestPasswordResetLinkViewResponse
*/
public function store(Request $request): Responsable
{
$request->validate([Fortify::emailAddress() => 'required|email']);
$request->validate([Fortify::email() => 'required|email']);

// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$status = $this->broker()->sendResetLink(
$request->only(Fortify::emailAddress())
$request->only(Fortify::email())
);

return $status == Password::RESET_LINK_SENT
Expand Down
2 changes: 1 addition & 1 deletion stubs/fortify.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
| needs another name, you are free to set the name of it here.
|
*/
'email_address' => 'email',
'email' => 'email',

/*
|--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion tests/NewPasswordControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function test_password_reset_can_fail_with_json()

public function test_password_can_be_reset_with_customized_email_address_field()
{
Config::set('fortify.email_address', 'emailAddress');
Config::set('fortify.email', 'emailAddress');
Password::shouldReceive('broker')->andReturn($broker = Mockery::mock(PasswordBroker::class));

$guard = $this->mock(StatefulGuard::class);
Expand Down
2 changes: 1 addition & 1 deletion tests/PasswordResetLinkRequestControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function test_reset_link_request_can_fail_with_json()

public function test_reset_link_can_be_successfully_requested_with_customized_email_field()
{
Config::set('fortify.email_address', 'emailAddress');
Config::set('fortify.email', 'emailAddress');
Password::shouldReceive('broker')->andReturn($broker = Mockery::mock(PasswordBroker::class));

$broker->shouldReceive('sendResetLink')->andReturn(Password::RESET_LINK_SENT);
Expand Down

0 comments on commit 7dc23ed

Please sign in to comment.