Homepage
Main navigation
Main content
Additional information
October Tricks
Login / Sign up
Quality Guidelines
About
GitHub
Propose new content
October CMS resources and help articles
Simple and to the point. Optimized by the community.
×
Login / Sign up
Quality Guidelines
About
GitHub
Propose new content
Edit trick
Changes will be published after manual review
Title
Give your trick a describing title. Do
not
start with «How to...».
Your trick
Keep it short and concise! Markdown is supported.
Often times we need to tie into the signin flow for the Backend. This is common when trying to support SSO, or authenticating with LDAP/AD mechanisms. This trick shows you how to do this by overriding the Backend Controller's sign in method. The Trick "[Re-use and migrate WordPress password hashes in October](https://octobertricks.com/tricks/re-use-and-migrate-wordpress-password-hashes-in-october)" shows you an alternative approach by overriding October's AuthManager class (see steps 3 and 4 of the Trick). You can override the default signin behavior for the backend with a fairly simple addition to your plugin's `boot()` method: ``` /* * Override default sign in behavior */ Event::listen('backend.page.beforeDisplay', function ($controller, $action) { if(!$controller instanceof \Backend\Classes\Controller) { return; } if ($action == 'signin') { try { if (post('postback')) { return $this->signin_onSubmit(); } } catch (Exception $ex) { Flash::error($ex->getMessage()); } } }); ``` That's pretty much all there is to it. Obviously the logic for the sign in behavior will need to be implemeneted per your requirements, but the possibilities are limitless.
References
Add additional online resources to your trick
+ Add reference
Topics
If your trick fits more than one topic select multiple. Select at least one.
Backend
Plugin Development
CMS
Twig
Themes
Deployment
Tags
You can use existing tags or create new ones. Add at least one.
Submit for review
Cancel
We use cookies to measure the performance of this website. Do you want to accept these cookies?
Accept
Decline