1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Redirect to url if next is available for key_login

This commit is contained in:
Benjamin Beganović 2021-08-10 10:18:05 +02:00
parent e617c7aade
commit 2ed6e7643d

View File

@ -71,11 +71,16 @@ class ContactKeyLogin
}
} elseif ($request->segment(2) && $request->segment(2) == 'key_login' && $request->segment(3)) {
if ($client_contact = ClientContact::where('contact_key', $request->segment(3))->first()) {
if(empty($client_contact->email))
if(empty($client_contact->email)) {
$client_contact->email = Str::random(6) . "@example.com"; $client_contact->save();
}
auth()->guard('contact')->login($client_contact, true);
if ($request->query('next')) {
return redirect($request->query('next'));
}
return redirect()->to('client/dashboard');
}
} elseif ($request->has('client_hash') && config('ninja.db.multi_db_enabled')) {
@ -106,7 +111,6 @@ class ContactKeyLogin
}
}
return $next($request);
}
}