0

I have a particular authentication flow that must occur for Backend Users on my OctoberCMS web app. The process involves 2-factor authentication.

Initially, I thought of a direct hack into 'backend.auth.extendSigninView' event to alter the login form directly using Javascript and then setting the form action to the desired route.

EXAMPLE:

   Event::listen('backend.auth.extendSigninView', function($controller) {
        $controller->addJs('/plugins/x/y/assets/z.js')
    });

That idea seemed "SUPER HACKEY" to me so I spent way too much time trying to find the "right way" to hook into the sign-in without success.

I have now come across another coder who posted https://github.com/khoatran/october-ldap their idea using the above-mentioned hack of using 'backend.auth.extendSigninView' to allow JS to redraw the form.

Does anyone know a better way or is this the best approach?

David Lundquist
  • 690
  • 7
  • 19

1 Answers1

1

This will let you override the path for the views and controllers. Hope this helps!:

<?php


    \Backend\Controllers\Auth::extend(function (\Backend\Controllers\Auth $controller){
        $controller->layoutPath = ['$/author/plugin/loginscreen/layouts'];
        $controller->suppressLayout = true;
        $controller->addViewPath('$/author/plugin/loginscreen/controllers');
    });
?>
Ben Watson
  • 36
  • 2