Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMS Login page breaks when a port number is present in the URL #4261

Closed
marknotton opened this issue May 14, 2019 · 2 comments
Closed

CMS Login page breaks when a port number is present in the URL #4261

marknotton opened this issue May 14, 2019 · 2 comments

Comments

@marknotton
Copy link

Description

In any circumstance where a port number is present in the URL the CMS Login page breaks. The login form doesn't show up due to a Javascript error:

Uncaught SyntaxError: Unexpected token : Login : 87

This is happening because of an odd syntax issue occurring with the use of escape expressions on the quotations when setting the brand logo image. I'm afraid I don't know the technical reasons for the error, but I do know how to fix it.

On line 37 of the craftcms/cms/src/templates/login.html template a simple space will resolve the problem:

Before
style="background-image: url(\'{{ logo.url }}\');

After
style="background-image: url(\' {{ logo.url }}\');

or you can remove the escaped quotations all-together

style="background-image: url({{ logo.url }});

I hope this helps. Thanks.

Steps to reproduce

  1. Go to your CMS login page with a port number: http://www.website.com:3000/admin/login

Additional info

  • Craft version: 3.1.26
  • PHP version: 7.2.14
@brandonkelly
Copy link
Member

Thanks for reporting that!

@brandonkelly
Copy link
Member

Removing the 's broke the page for someone else (#4262), so have reverted that commit. Don’t want to add a space to the beginning of the URL as that feels too hacky.

Guessing the bug has more to do with your logo filename than the port number; looks like we’re not sanitizing the filename anywhere so there’s a chance the filename could break things. Will fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants