laravel-enso/core

Enso LoginController extending Local LoginController - unable to customize attepmtLogin()

robbykrlos opened this issue · 2 comments

This is a possible feature request.

Prerequisites

  • [N] Are you running the latest version?
  • [Y] Are you reporting to the correct repository?
  • [N] Did you check the documentation?
  • [Y] Did you perform a cursory search?

Description

I'm trying to extend the Auth middle-ware with an additional check similar to "is_active" user flag.

In theory I'd like to extend the implementation of attemptLogin method from lbdash/vendor/laravel-enso/core/src/app/Http/Controllers/Auth/LoginController.php with an additional check similar to

if ($user->isDisabled()) {
            throw new AuthenticationException(__(
                'Your account has been disabled. Please contact the administrator'
            ));
        }
  • additionally I need a new local middle-ware similar to LaravelEnso\Core\app\Http\Middleware\VerifyActiveState...

Well, because the lbdash/vendor/laravel-enso/core/src/app/Http/Controllers/Auth/LoginController.php extends "Controller" local App\Http\Controllers\Auth\LoginController as Controller, I cannot override the method attemptLogin() since it will be further overridden by Enso's implementation.

I don't see an elegant solution at the moment.
I can only think of using bindings and bind the EnsoLoginController to another local LoginController (App\Http\Controllers\Auth\OverrideEnsoLoginController) that will not override attemptLogin(remove implementation) and used it from my local App\Http\Controllers\Auth\LoginController

Any ideas?

I can only think of using bindings and bind the EnsoLoginController to another local LoginController (App\Http\Controllers\Auth\OverrideEnsoLoginController) that will not override attemptLogin(remove implementation) and used it from my local App\Http\Controllers\Auth\LoginController

I guess you can bind it directly to the existing local LoginController

Or you can override locally the specific route for the action you need to customize.

Thanks