OctoberCMS:我如何钩定/自定义后台身份验证表单和应用程序流的登录?
问题描述:
我有一个特殊的身份验证流程,必须针对我的OctoberCMS网络应用程序中的后端用户进行。该过程涉及双因素身份验证。OctoberCMS:我如何钩定/自定义后台身份验证表单和应用程序流的登录?
最初,我想到了'backend.auth.extendSigninView'事件的直接攻击,直接使用Javascript更改登录表单,然后将表单动作设置为所需的路由。
例:
Event::listen('backend.auth.extendSigninView', function($controller) {
$controller->addJs('/plugins/x/y/assets/z.js')
});
这想法似乎“SUPER HACKEY”给我,让我花了太多时间试图找到“正确的方式”挂钩到登录没有成功。
我现在遇到了另一位编码员,他们发布了https://github.com/khoatran/october-ldap他们的想法,使用上面提到的使用'backend.auth.extendSigninView'的黑客来允许JS重绘表单。
有谁知道更好的方法还是这是最好的方法?
答
这将让您覆盖视图和控制器的路径。希望这会有所帮助!:
<?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');
});
?>
我会试试这个谢谢! –