Skip to content

Commit

Permalink
still use strings for passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 19, 2024
1 parent eed57b8 commit d86d3ad
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Auth/Passwords/PasswordBroker.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Illuminate\Auth\Passwords;

use Closure;
use Illuminate\Auth\Enums\PasswordResetResult;
use Illuminate\Auth\Events\PasswordResetLinkSent;
use Illuminate\Auth\Passwords\PasswordResetResult;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Contracts\Auth\PasswordBroker as PasswordBrokerContract;
use Illuminate\Contracts\Auth\UserProvider;
Expand Down Expand Up @@ -55,7 +55,7 @@ public function __construct(#[\SensitiveParameter] TokenRepositoryInterface $tok
*
* @param array $credentials
* @param \Closure|null $callback
* @return \Illuminate\Auth\Enums\PasswordResetResult
* @return string
*/
public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closure $callback = null)
{
Expand Down Expand Up @@ -122,7 +122,7 @@ public function reset(#[\SensitiveParameter] array $credentials, Closure $callba
* Validate a password reset for the given credentials.
*
* @param array $credentials
* @return \Illuminate\Contracts\Auth\CanResetPassword|\Illuminate\Auth\Enums\PasswordResetResult
* @return \Illuminate\Contracts\Auth\CanResetPassword|string
*/
protected function validateReset(#[\SensitiveParameter] array $credentials)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<?php

namespace Illuminate\Auth\Enums;
namespace Illuminate\Auth\Passwords;

enum PasswordResetResult: string
class PasswordResetResult
{
/**
* Result indicating a successfully sent password reset email.
*/
case ResetLinkSent = 'passwords.sent';
const ResetLinkSent = 'passwords.sent';

/**
* Result representing a successfully reset password.
*/
case PasswordReset = 'passwords.reset';
const PasswordReset = 'passwords.reset';

/**
* Result indicating the user is invalid.
*/
case InvalidUser = 'passwords.user';
const InvalidUser = 'passwords.user';

/**
* Result indicating the token is invalid.
*/
case InvalidToken = 'passwords.token';
const InvalidToken = 'passwords.token';

/**
* Result indicating the password reset attempt has been throttled.
*/
case Throttled = 'passwords.throttled';
const Throttled = 'passwords.throttled';
}
14 changes: 7 additions & 7 deletions src/Illuminate/Contracts/Auth/PasswordBroker.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,42 @@
namespace Illuminate\Contracts\Auth;

use Closure;
use Illuminate\Auth\Enums\PasswordResetResult;
use Illuminate\Auth\Passwords\PasswordResetResult;

interface PasswordBroker
{
/**
* Constant representing a successfully sent reminder.
*
* @var \Illuminate\Auth\Enums\PasswordStatus
* @var string
*/
const RESET_LINK_SENT = PasswordResetResult::ResetLinkSent;

/**
* Constant representing a successfully reset password.
*
* @var \Illuminate\Auth\Enums\PasswordStatus
* @var string
*/
const PASSWORD_RESET = PasswordResetResult::PasswordReset;

/**
* Constant representing the user not found response.
*
* @var \Illuminate\Auth\Enums\PasswordStatus
* @var string
*/
const INVALID_USER = PasswordResetResult::InvalidUser;

/**
* Constant representing an invalid token.
*
* @var \Illuminate\Auth\Enums\PasswordStatus
* @var string
*/
const INVALID_TOKEN = PasswordResetResult::InvalidToken;

/**
* Constant representing a throttled reset attempt.
*
* @var \Illuminate\Auth\Enums\PasswordStatus
* @var string
*/
const RESET_THROTTLED = PasswordResetResult::Throttled;

Expand All @@ -47,7 +47,7 @@ interface PasswordBroker
*
* @param array $credentials
* @param \Closure|null $callback
* @return \Illuminate\Auth\Enums\PasswordStatus
* @return string
*/
public function sendResetLink(array $credentials, ?Closure $callback = null);

Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Support/Facades/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Illuminate\Support\Facades;

use Illuminate\Auth\Enums\PasswordResetResult;
use Illuminate\Auth\Passwords\PasswordResetResult;

/**
* @method static \Illuminate\Contracts\Auth\PasswordBroker broker(string|null $name = null)
* @method static string getDefaultDriver()
* @method static void setDefaultDriver(string $name)
* @method static \Illuminate\Auth\Enums\PasswordResetResult sendResetLink(array $credentials, \Closure|null $callback = null)
* @method static string sendResetLink(array $credentials, \Closure|null $callback = null)
* @method static mixed reset(array $credentials, \Closure $callback)
* @method static \Illuminate\Contracts\Auth\CanResetPassword|null getUser(array $credentials)
* @method static string createToken(\Illuminate\Contracts\Auth\CanResetPassword $user)
Expand Down

0 comments on commit d86d3ad

Please sign in to comment.