Hello,
Im building a internal custom app and using the password_policy app as an example of how to code it. Im only need a Event Listener and got $context->registerEventListener(BeforeUserLoggedInEvent::class, BeforeUserLoggedInEventListener::class); in the lib/AppInfo/Applicaton.php like the policy app has and have the file lib/Listener/BeforeUserLoggedInEventListener.php like the policy app as well with correct namespaces and what not, yet on user login I get the following error:
{“reqId”:“XXXXXXXXXXXXX”,“level”:3,“time”:“2021-01-22T18:32:18+00:00”,“remoteAddr”:“X.X.X.X,“user”:”–",“app”:“no app in context”,“method”:“POST”,“url”:"/index.php/login",“message”:{“Exception”:“OCP\AppFramework\QueryException”,“Message”:“Could not resolve OCA\MyCustomInternalApp\Listener\BeforeUserLoggedInEventListener! Class OCA\MyCustomInternalApp\Listener\BeforeUserLoggedInEventListener does not exist”,“Code”:0,“Trace”:[{“file”:"/var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",“l
…
on”:“handleRequest”,“class”:“OC”,“type”:"::"}],“File”:"/var/www/html/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php",“Line”:115,“CustomMessage”:“Could not load event listener service OCA\MyCustomInternalApp\Listener\BeforeUserLoggedInEventListener”},“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36”,“version”:“20.0.5.2”}
Enabling the app without issue, no other errors and permissions are set correctly, I spent a day and a half trying to figure this out before coming on here. Not sure why its not seeing the file and using it. Can anyone help?