Fix: Get nami user

This commit is contained in:
philipp lang 2021-04-09 23:31:28 +02:00
parent a9a64e61cb
commit 2448a3df0b
1 changed files with 8 additions and 3 deletions

View File

@ -34,12 +34,17 @@ class NamiUserProvider implements UserProvider {
try {
$api = $user->attemptNamiLogin($credentials['password']);
$data = collect($api->allMembers()->data)->first(function($member) use ($credentials) {
return $member->entries_mitgliedsNummer == $credentials['mglnr'];
$group = $api->group($credentials['groupid']);
$data = $group->memberOverview()->first(function($member) use ($credentials) {
return $member->mitgliedsnr == $credentials['mglnr'];
});
if (!$data) {
return false;
}
Cache::forever('member.'.$credentials['mglnr'], [
'data' => $api->getMember($data->id)->data,
'data' => $data,
'credentials' => $credentials
]);