Adriano Faria Posted November 18, 2023 Posted November 18, 2023 If you have a 3rd-party resource that adds a new login method and disables the app, the new login method keeps showing up in Login & Registration -> Methods tab and in Account Settings: - Apps disabled: - Login methods: - Account Settings: Thank you.
Marc Posted November 20, 2023 Posted November 20, 2023 Thank you for bringing this issue to our attention! I can confirm this should be further reviewed and I have logged an internal bug report for our development team to investigate and address as necessary, in a future maintenance release.
Daniel F Posted November 20, 2023 Posted November 20, 2023 I can't reproduce this. How have you implemented the handler? Your code should update the login_enabled column in the core_login_methods table when the application gets disabled.
Adriano Faria Posted November 20, 2023 Author Posted November 20, 2023 Is this information available here somewhere ? Is there any method to add in my Application() to toggle the app state or do I need a hook? In case it is a hook, will it be available on IPS5?
Daniel F Posted November 20, 2023 Posted November 20, 2023 There was actually bug that resulted in disabled login handlers being still accessible, which I have fixed now. You'll still have to disable it when the application is disabled.
Adriano Faria Posted November 20, 2023 Author Posted November 20, 2023 7 minutes ago, Daniel F said: You'll still have to disable it when the application is disabled. Via a hook?
Daniel F Posted November 20, 2023 Posted November 20, 2023 We have literally a method for this. Just implement it in your application class. /** * Toggle Enabled/Disable * * @return void */ protected function enableToggle() Adriano Faria 1
Adriano Faria Posted November 20, 2023 Author Posted November 20, 2023 32 minutes ago, Daniel F said: We have literally a method for this. Just implement it in your application class. /** * Toggle Enabled/Disable * * @return void */ protected function enableToggle() That works for node controllers (disable and app, plugin, etc.). Application class isn’t a controller.
teraßyte Posted November 20, 2023 Posted November 20, 2023 For Application.php you can use: /** * Cleanup after saving * * @param bool $skipMember Skip clearing member cache clearing * @return void * @note This is abstracted so it can be called externally, i.e. by the support tool */ public static function postToggleEnable( $skipMember=FALSE ) { # Parent call parent:postToggleEnable( $skipMember ); # Your code here # [...] } Or you can also extend set_enabled(): /** * [Node] Set whether or not this node is enabled * * @param bool|int $enabled Whether to set it enabled or disabled * @return void */ protected function set__enabled( $enabled ) { # Parent call parent:set__enabled( $enabled ); # Your code here # [...] } They actually use set_enabled() to switch the application's tasks (which is what you want to do with the login handler): /* Update other app specific task statuses */ \IPS\Db::i()->update( 'core_tasks', array( 'enabled' => (int) $this->enabled ), array( 'app=?', $this->directory ) ); SeNioR- and Adriano Faria 1 1
Adriano Faria Posted November 20, 2023 Author Posted November 20, 2023 (edited) 50 minutes ago, teraßyte said: Or you can also extend Not sure this will be available somehow in V5 so I’ll go with the postToggleEnable. 👍 Edited November 20, 2023 by Adriano Faria SeNioR- 1
Solution Marc Posted January 24 Solution Posted January 24 This issue has been resolved in the recently released 4.7.15 version. Please update your site if you are still experiencing the issue, and let us know if you see any reoccurrence.
Recommended Posts