Skip to content

Commit 4d901b3

Browse files
committed
feat: propagate can_login to UI and give more feedback
Signed-off-by: romanetar <roman_ag@hotmail.com>
1 parent b368424 commit 4d901b3

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

app/Http/Controllers/UserController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,15 @@ public function getAccount()
258258

259259
$user = $this->auth_service->getUserByUsername($email);
260260

261-
if (is_null($user) || !$user->canLogin())
261+
if (is_null($user))
262262
throw new EntityNotFoundException();
263263

264264
return $this->ok(
265265
[
266+
'can_login' => $user->canLogin(),
266267
'pic' => $user->getPic(),
267268
'full_name' => $user->getFullName(),
268-
'has_password_set' => $user->hasPasswordSet()
269+
'has_password_set' => $user->hasPasswordSet(),
269270
]
270271
);
271272
} catch (ValidationException $ex) {

resources/js/login/login.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,10 @@ class LoginPage extends React.Component {
533533
...this.state,
534534
user_pic: response.pic,
535535
user_fullname: response.full_name,
536-
user_verified: true,
536+
user_verified: response.can_login,
537537
authFlow: response.has_password_set ? password_flow : otp_flow,
538538
errors: {
539-
email: '',
539+
email: response.can_login ? '' : 'User is inactive or email verification is pending.',
540540
otp: '',
541541
password: ''
542542
},

0 commit comments

Comments
 (0)