mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Final touches for #2085
This commit is contained in:
parent
c8c71da903
commit
451c86e431
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Auth;
|
namespace FireflyIII\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use Adldap;
|
||||||
use DB;
|
use DB;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
@ -70,6 +71,15 @@ class LoginController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function login(Request $request)
|
public function login(Request $request)
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Temporary bug fix for something that doesn't seem to work in
|
||||||
|
* AdLdap.
|
||||||
|
*/
|
||||||
|
$schema = config('ldap.connections.default.schema');
|
||||||
|
|
||||||
|
/** @var Adldap\Connections\Provider $provider */
|
||||||
|
Adldap::getProvider('default')->setSchema(new $schema);
|
||||||
|
|
||||||
Log::channel('audit')->info(sprintf('User is trying to login using "%s"', $request->get('email')));
|
Log::channel('audit')->info(sprintf('User is trying to login using "%s"', $request->get('email')));
|
||||||
$this->validateLogin($request);
|
$this->validateLogin($request);
|
||||||
|
|
||||||
@ -77,6 +87,7 @@ class LoginController extends Controller
|
|||||||
// the login attempts for this application. We'll key this by the username and
|
// the login attempts for this application. We'll key this by the username and
|
||||||
// the IP address of the client making these requests into this application.
|
// the IP address of the client making these requests into this application.
|
||||||
if ($this->hasTooManyLoginAttempts($request)) {
|
if ($this->hasTooManyLoginAttempts($request)) {
|
||||||
|
Log::channel('audit')->info(sprintf('Login for user "%s" was locked out.', $request->get('email')));
|
||||||
$this->fireLockoutEvent($request);
|
$this->fireLockoutEvent($request);
|
||||||
|
|
||||||
/** @noinspection PhpInconsistentReturnPointsInspection */
|
/** @noinspection PhpInconsistentReturnPointsInspection */
|
||||||
@ -85,6 +96,7 @@ class LoginController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->attemptLogin($request)) {
|
if ($this->attemptLogin($request)) {
|
||||||
|
Log::channel('audit')->info(sprintf('User "%s" has been logged in.', $request->get('email')));
|
||||||
// user is logged in. Save in session if the user requested session to be remembered:
|
// user is logged in. Save in session if the user requested session to be remembered:
|
||||||
$request->session()->put('remember_login', $request->filled('remember'));
|
$request->session()->put('remember_login', $request->filled('remember'));
|
||||||
|
|
||||||
@ -97,7 +109,7 @@ class LoginController extends Controller
|
|||||||
// to login and redirect the user back to the login form. Of course, when this
|
// to login and redirect the user back to the login form. Of course, when this
|
||||||
// user surpasses their maximum number of attempts they will get locked out.
|
// user surpasses their maximum number of attempts they will get locked out.
|
||||||
$this->incrementLoginAttempts($request);
|
$this->incrementLoginAttempts($request);
|
||||||
|
Log::channel('audit')->info(sprintf('Login attempt for user "%s" failed.', $request->get('email')));
|
||||||
/** @noinspection PhpInconsistentReturnPointsInspection */
|
/** @noinspection PhpInconsistentReturnPointsInspection */
|
||||||
/** @noinspection PhpVoidFunctionResultUsedInspection */
|
/** @noinspection PhpVoidFunctionResultUsedInspection */
|
||||||
return $this->sendFailedLoginResponse($request);
|
return $this->sendFailedLoginResponse($request);
|
||||||
|
@ -37,7 +37,6 @@ if ('FreeIPA' === envNonEmpty('ADLDAP_CONNECTION_SCHEME', 'OpenLDAP')) {
|
|||||||
if ('ActiveDirectory' === envNonEmpty('ADLDAP_CONNECTION_SCHEME', 'OpenLDAP')) {
|
if ('ActiveDirectory' === envNonEmpty('ADLDAP_CONNECTION_SCHEME', 'OpenLDAP')) {
|
||||||
$schema = ActiveDirectory::class;
|
$schema = ActiveDirectory::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user