Skip to content

Commit

Permalink
Change casing for enum cases
Browse files Browse the repository at this point in the history
Co-authored-by: Džuris <[email protected]>
  • Loading branch information
shaedrich and tontonsb authored Dec 18, 2024
1 parent a8eca1b commit 935efcc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/Illuminate/Auth/Enums/PasswordStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ enum PasswordStatus: string
/**
* Constant representing a successfully sent reminder.
*/
case RESET_LINK_SENT = 'passwords.sent';
case ResetLinkSent = 'passwords.sent';

/**
* Constant representing a successfully reset password.
*/
case PASSWORD_RESET = 'passwords.reset';
case PasswordReset = 'passwords.reset';

/**
* Constant representing the user not found response.
*/
case INVALID_USER = 'passwords.user';
case InvalidUser = 'passwords.user';

/**
* Constant representing an invalid token.
*/
case INVALID_TOKEN = 'passwords.token';
case InvalidToken = 'passwords.token';

/**
* Constant representing a throttled reset attempt.
*/
case RESET_THROTTLED = 'passwords.throttled';
case ResetThrottled = 'passwords.throttled';
}
14 changes: 7 additions & 7 deletions src/Illuminate/Auth/Passwords/PasswordBroker.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closur
$user = $this->getUser($credentials);

if (is_null($user)) {
return PasswordStatus::INVALID_USER;
return PasswordStatus::InvalidUser;
}

if ($this->tokens->recentlyCreatedToken($user)) {
return PasswordStatus::RESET_THROTTLED;
return PasswordStatus::ResetThrottled;
}

$token = $this->tokens->create($user);

if ($callback) {
return $callback($user, $token) ?? PasswordStatus::RESET_LINK_SENT;
return $callback($user, $token) ?? PasswordStatus::ResetLinkSent;
}

// Once we have the reset token, we are ready to send the message out to this
Expand All @@ -85,7 +85,7 @@ public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closur

$this->events?->dispatch(new PasswordResetLinkSent($user));

return PasswordStatus::RESET_LINK_SENT;
return PasswordStatus::ResetLinkSent;
}

/**
Expand Down Expand Up @@ -115,7 +115,7 @@ public function reset(#[\SensitiveParameter] array $credentials, Closure $callba

$this->tokens->delete($user);

return PasswordStatus::PASSWORD_RESET;
return PasswordStatus::PasswordReset;
}

/**
Expand All @@ -127,11 +127,11 @@ public function reset(#[\SensitiveParameter] array $credentials, Closure $callba
protected function validateReset(#[\SensitiveParameter] array $credentials)
{
if (is_null($user = $this->getUser($credentials))) {
return PasswordStatus::INVALID_USER;
return PasswordStatus::InvalidUser;
}

if (! $this->tokens->exists($user, $credentials['token'])) {
return PasswordStatus::INVALID_TOKEN;
return PasswordStatus::InvalidToken;
}

return $user;
Expand Down
10 changes: 5 additions & 5 deletions src/Illuminate/Contracts/Auth/PasswordBroker.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@ interface PasswordBroker
*
* @var string
*/
const RESET_LINK_SENT = PasswordStatus::RESET_LINK_SENT;
const RESET_LINK_SENT = PasswordStatus::ResetLinkSent;

/**
* Constant representing a successfully reset password.
*
* @var string
*/
const PASSWORD_RESET = PasswordStatus::PASSWORD_RESET;
const PASSWORD_RESET = PasswordStatus::PasswordReset;

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

/**
* Constant representing an invalid token.
*
* @var string
*/
const INVALID_TOKEN = PasswordStatus::INVALID_TOKEN;
const INVALID_TOKEN = PasswordStatus::InvalidToken;

/**
* Constant representing a throttled reset attempt.
*
* @var string
*/
const RESET_THROTTLED = PasswordStatus::RESET_THROTTLED;
const RESET_THROTTLED = PasswordStatus::ResetThrottled;

/**
* Send a password reset link to a user.
Expand Down
10 changes: 5 additions & 5 deletions src/Illuminate/Support/Facades/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,35 @@ class Password extends Facade
*
* @var string
*/
const RESET_LINK_SENT = PasswordStatus::RESET_LINK_SENT;
const RESET_LINK_SENT = PasswordStatus::ResetLinkSent;

/**
* Constant representing a successfully reset password.
*
* @var string
*/
const PASSWORD_RESET = PasswordStatus::PASSWORD_RESET;
const PASSWORD_RESET = PasswordStatus::PasswordReset;

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

/**
* Constant representing an invalid token.
*
* @var string
*/
const INVALID_TOKEN = PasswordStatus::INVALID_TOKEN;
const INVALID_TOKEN = PasswordStatus::InvalidToken;

/**
* Constant representing a throttled reset attempt.
*
* @var string
*/
const RESET_THROTTLED = PasswordStatus::RESET_THROTTLED;
const RESET_THROTTLED = PasswordStatus::ResetThrottled;

/**
* Get the registered name of the component.
Expand Down

0 comments on commit 935efcc

Please sign in to comment.