Problem/Motivation
The following line in opigno_dashboard.module can cause logins to fail:
$default_route = \Drupal::pathValidator()->getUrlIfValid($default_path)->getRouteName();
getUrlIfValid() can return a FALSE if path is missing (e.g. disabled, unpublished, etc.), which can cause getRouteName() to fail. This line is in a login form submit hook. When this code throws an exception, it can prevent logins.
Steps to reproduce
1. Change the path of views.frontpage.page_1 (the front page view) to something else (e.g. /dashboard).
- Optionally, move all Opigno dashboard blocks in Block Layout to that new path.
2. Create a node page or a page_manager page.
3. Set the site homepage to the page created in step 2.
4. Log in and log out like normal.
5. Disable/unpublish the page created in step 2.
6. Try logging in.
Step 6 will throw an error:
Error: Call to a member function getRouteName() on bool in opigno_dashboard_user_login_submit() (line 277 of /var/app/current/web/modules/contrib/opigno_dashboard/opigno_dashboard.module)
Proposed resolution
Apply attached patch.
Remaining tasks
Review and test.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
oleksandr.s commentedPatch attached to issue description successfully fix the error. The error disappears. But you will be redirect to unexisting page if unpublished/removed node was set as front page. To fix it I would propose the following patch.
So if default uri is not valid
$default_uri = \Drupal::pathValidator()->getUrlIfValid($default_path);then
$route_namewill be used as$default_routeAnd then build url if
$route_nameequals to$default_routeComment #3
ricardoamaro commentedI have tested patch #2 (https://www.drupal.org/project/opigno_dashboard/issues/3251764#comment-1...) locally, and it is working properly.
Comment #4
ricardoamaro commentedComment #5
axelmHi
Thanks for reporting this. We are aware of this issue and it will be fixed in the next Opigno release.
Comment #6
axelmComment #7
axelmReleased in Opigno 3.1.0
Comment #8
axelmComment #9
axelm