Login to Luci interface does not work in Chrome/Brave, Firefox ok

apologies... I'd seen almost duplicate symtomatology... so thought more meta-data in the mix would assist in fault finding...

feel free to disregard my input...

Well the current bootstrap theme in master uses a JavaScript modal overlay for the login dialog, the username and password values are sent as FormData via XHR to the router, the router replies with the normal page (including a Set-Cookie: sysauth... header). This response is discarded by the JavaScript and a location.reload() is triggered instead to reload the entire page after login.

For some reason some browsers under some circumstances (which I couldn't figure out since it works for me on all my devices) do not "take" the sysauth cookie offered via Set-Cookie in the XHR reply and load the page without any cookie after location.reload() which then will trigger the login again, etc.

Edit:
Maybe you can try the following change on your affected devices:

diff --git a/themes/luci-theme-bootstrap/htdocs/luci-static/resources/view/bootstrap/sysauth.js b/themes/luci-theme-bootstrap/htdocs/luci-static/resources/view/bootstrap/sysauth.js
index 344b043a36..dbc1e4fc57 100644
--- a/themes/luci-theme-bootstrap/htdocs/luci-static/resources/view/bootstrap/sysauth.js
+++ b/themes/luci-theme-bootstrap/htdocs/luci-static/resources/view/bootstrap/sysauth.js
@@ -92,7 +92,7 @@ return view.extend({
 
                Object.getPrototypeOf(L).notifySessionExpiry = function() {};
 
-               return request.post(location.href, fd).then(this.handleLoginReply, this.handleLoginError);
+               return request.post(location.href, fd, { credentials: true }).then(this.handleLoginReply, this.handleLoginError);
        },
 
        addFooter: function() {}

Sed oneliner to hot-patch on the router (assuming minified JS):

sed -i.bak -e 's#request.post(location.href,fd)#request.post(location.href,fd,{credentials:true})#' /www/luci-static/resources/view/bootstrap/sysauth.js

After applying it, clear cache and retry.

1 Like
3 Likes

There have been similar login issues with luci-theme-bootstrap on 21.02.x builds as well that seem to be most problematic after flashing a new build. So it really affects being able to set the password initially.

Could you please send this fix (if possible) to the 21.02 luci branch as well?

This sounds like the usual HTTP sysauth cookie is not allowed to overwrite yet existing HTTPS sysauth cookie issue, unrelated to this particular problem here.

This fix addresses changes which weren't added to 21.02 yet.

1 Like

This didn't work for me.

But this worked! Is it possible to bring this patch to master?

It already is.

1 Like

Thank you sir! May you have a great weekend!

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.