Skip to content

Commit 0508f60

Browse files
committed
fix(ui): unverified user (#122)
* fix(ui): unverified user * fix(auth): null check before calling getId() in verifyEmail Split combined null/inactive check into separate guards to prevent "Call to a member function getId() on null" when no user is found for the verification token.
1 parent cd7b72e commit 0508f60

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/Services/Auth/UserService.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,12 @@ public function verifyEmail(string $token): User
225225
return $this->tx_service->transaction(function () use ($token) {
226226
$user = $this->user_repository->getByVerificationEmailToken($token);
227227

228-
if (is_null($user) || !$user->isActive()) {
228+
if (is_null($user)) {
229+
Log::warning("UserService::verifyEmail no user found for token");
230+
throw new EntityNotFoundException();
231+
}
232+
233+
if (!$user->isActive()) {
229234
Log::warning(sprintf("UserService::verifyEmail user with id %s is not active", $user->getId()));
230235
throw new EntityNotFoundException();
231236
}

resources/js/login/login.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ class LoginPage extends React.Component {
617617
}, function () {
618618
//Once the state is updated, it's now possible to trigger emitOtpAction.
619619
//No need to wait for the component to update.
620-
if (!response.has_password_set) {
620+
if (!response.has_password_set && response.is_verified !== false) {
621621
this.emitOtpAction();
622622
}
623623
});

0 commit comments

Comments
 (0)