restcontroller: auth :fix user nullpointer

add missing parameter to cutler env
This commit is contained in:
Schneider Roland 2023-01-12 10:49:25 +01:00
parent eca459cb65
commit bf5a1f34ab
2 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,6 @@
<?php
$REST_ALLOW_VERIFY_ONLY=getenv('FITNESS_REST_ALLOW_VERIFY_ONLY');
return [
'user.passwordResetTokenExpire' => 3600,
'company' => 'gyor',//gyor
@ -20,5 +22,6 @@ return [
'reception_transfer_list_only_today' => true,
'reception_show_stock' => false,
'login_admin_email' => false,
'warn_ticket_expire_in_usage_count' => 10
'warn_ticket_expire_in_usage_count' => 10,
'rest_allow_verify_only' => $REST_ALLOW_VERIFY_ONLY === 'true'
];

View File

@ -24,12 +24,19 @@ class RestController extends Controller
{
try {
$user = User::findOne(['username' => $username]);
if ( !isset($user ) ){
\Yii::error("User not found: ".$username);
return null;
}
if ($user->validatePassword($password)) {
return $user;
}
} catch (\Exception $e) {
\Yii::error("Failed to load user: " . $e->getMessage());
\Yii::error("Failed to load user $username: " . $e->getMessage());
}
\Yii::error("User not found: ".$username);
return null;
}