Skip to content

Instantly share code, notes, and snippets.

@anouarabdsslm
anouarabdsslm / gist:48f7cdef9fc12e4a86b63389409ace30
Last active March 16, 2024 00:09
Suggestions for improving the Customer 2Fac authentication

The UserCheckController only performs one task, which is checking if we can respond to the two-factor authentication if it's enabled. I suggest using an invocable controller, like this:

class UserCheckController extends Controller {

   public function __invoke(LoginCheckUserRequest $request) {}
}

I also prefer to extract the business logic to an action (sometimes referred to as a command bus), for example Actions\CustomerPortal\HandleUserLogin. This provides better organization by placing it under the CustomerPortal namespace.