getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 168 forks source link

Registering your Kirby 3 license causes a lock error #1933

Closed GiantCrocodile closed 5 years ago

GiantCrocodile commented 5 years ago

Describe the bug If you register your Kirby 3 license, you get a lock error because the user lock is unknown.

To Reproduce Steps to reproduce the behavior:

  1. Log in to the panel
  2. Click on the register button in the top right corner
  3. fill in your correct details
  4. License is registered but you get a lock error in console and it continues if you switch to the page where you administrate the user accounts.

Expected behavior No error in console log.

Screenshots Sadly no screenshot because I tried to find out the cause of the error and forgot to take a screenshot/console ouput log.

Kirby Version 3.2.2

Console output Sorry, see the screenshots section.

Desktop (please complete the following information):

lukasbestle commented 5 years ago

I can't reproduce this unfortunately. I also can't really picture where that error might come from, not even remotely. Sorry about that. :(

I'm closing this issue for now, please reopen/open a new issue if it happens again. Please provide as much information as possible, especially the complete stack trace of the error as well as information about your server and site setup.

GiantCrocodile commented 5 years ago

I moved the .license file and logged out and in again. Then I did register the license again, clicked on a page, switched to the users page and logged out. After logging out, I got these 2 errors (see screenshot) and I logged in again. Afterwards I went to a page, went to the users page, went to the Settings page and then I clicked on cancel of the 'add a new secondary language' dialog. Then the other errors occur. This time it complains indirect about locking by complaining about Invalid file model type.

grafik

I'm on a Windows 10 WAMP setup with wampserver64. The last errors happen when I stay on the Settings page.

Maybe this is only with multi lang sites. I'm sorry for my weak description - I'm not too good in describing this particular issue!

lukasbestle commented 5 years ago

Thanks for the additional information!

That's so strange! Do you have a custom directory setup by any chance?

GiantCrocodile commented 5 years ago

I'm not sure what custom directory setup refers to but I have this config file:

<?php

return [
    'debug'  => true,
    'languages' => true,
    'markdown' => [
        'extra' => true
    ]
];

German language setup: grafik

and I added an assets/css/ dir in the root folder of kirby (/ where the README.md lays) with a single .css file inside. This one is referenced by one of my templates via <?= css('assets/css/site.css') ?>. Do you ask/look for a specific info?

If you would like to have a copy of my project, I can delete the license and zip it for you. Please give me some email address for that then.

GiantCrocodile commented 5 years ago

Can this be caused by a reference to an invalid/non-existing field in the info and sortBy property of a blueprint:

articles.yml

type: pages
headline: Articles
info: "{{ page.date.toDate('d.m.Y') }}"
template: article
empty: No articles yet
sortBy: date desc

Maybe this was a follow-up error by this?

EDIT: Nope, I fixed this and error still persists.

lukasbestle commented 5 years ago

What I was referring to are changes to your index.php file where Kirby is initialized. Those changes are commonly made for multisite setups or other directory structure customizations.

I'm asking because the error messages look like your license file (which is named .license in the filesystem) might be picked up as Kirby content, which can only happen if it was accidentally written to a wrong directory.

GiantCrocodile commented 5 years ago

The license file is generated inside directory \site\config.

No changes to index.php as I wasn't aware about that part regarding multi language setups:

index.php

<?php

require 'kirby/bootstrap.php';

echo (new Kirby)->render();

Edit: To clarify, I'm only having a multi language setup, no multisite setup.

lukasbestle commented 5 years ago

Could you please test if the same error occurs if you follow these steps:

  1. Log out from the Panel
  2. Delete all files in site/sessions
  3. Delete the license file
  4. Create an empty file in site/config/.license
  5. Log in to the Panel again

Please also test if the error occurs if you follow the same steps but skip step 4 (= delete the license file and don't create a new empty file).

GiantCrocodile commented 5 years ago
  1. Logged out
  2. deleted all session files except the index.html
  3. deleted the license
  4. created an empty .license file
  5. logged into the panel again
  6. opened a page
  7. went to users
  8. clicked on my username (admin account, its the only user in the system)
  9. the given error occurs:

grafik

If I do the same steps you mentioned, except step 4:

No error on my user/account page but if I go to the Settings page then, I get this error:

grafik

Is this maybe 2 different errors? I'm not sure but seems like you are on the right way to find the problem due to the fact that the both ways cause different error messages.

distantnative commented 5 years ago

Are you using any custom page models, user models.. virtual pages?

GiantCrocodile commented 5 years ago

I played around with user blueprints to add a new structure field but I never used any model like this so far. If you want, I can export the project or provide a teamviewer session for debugging.

GiantCrocodile commented 5 years ago

Is this maybe caused due to my user having 'language' => 'en', although default language (and only language) is German (de)?

<?php

return [
    'email' => 't@t.org',
    'language' => 'en',
    'name' => 'test',
    'role' => 'admin'
];

(the email address is chosen because I want to type as less as possible on login on my local dev setup; its not a real one)

lukasbestle commented 5 years ago

Hm, that all looks like something is wrong with your installation (given that an error occurs even if you don't have a license file at all).

Could you please try setting up a fresh installation based on the starterkit? Basically like this:

  1. Set up an unchanged starterkit installation and test with that
  2. Register your license in the installation
  3. Log out, clear sessions and test again
  4. Enable multilang mode and set up languages
  5. Log out, clear sessions and test again
GiantCrocodile commented 5 years ago

I did the steps you told me to do with the starterkit-master zip. At first, I wasn't able to reproduce this error until I did these steps afterwards:

  1. create a Note page while my user had German as language set
  2. then I changed language of user to English, logged out and logged in to create another Note page
  3. Go to settings page and add a 2nd secondary language: Just press approve without input to trigger "Please enter a valid code for the language" error
  4. Then I went to my username and chose to change my email address: Just click on the email address field and then approve the same input as before (change nothing, just save9.
  5. Log out, delete sessions and then open some Note page, navigate to Users > your account > switch to Settings page

One of these steps for sure breaks the installation. I suspect that either #1905 or the new language adding without valid input validation (#1863) happens but still triggers some breaking change in the backend of the system. It is hard to find out which step exactly break it because either the error message is delayed or it's some really bad edge case I don't understand.

Proof: grafik

GiantCrocodile commented 5 years ago

Is it normal/correct behaviour that if I do log out, the log in page refreshes after one or two seconds to create a new session file and then I can log in? I noticed this when I deleted the session files but I suspect this is correct behaviour because otherwise no valid CORS token for log in page. After the refresh, everything you typed in before is lost, like email address or password. This makes it a bit annoying if you type too early, before the refresh.

tristantbg commented 5 years ago

I am having the same problem with virtual pages :

Capture d’écran 2019-08-22 à 10 26 04
lukasbestle commented 5 years ago

@tristantbg Which Kirby version do you use? What you are getting looks to me like the bug we fixed in v3.2.3.

tristantbg commented 5 years ago

@tristantbg Which Kirby version do you use? What you are getting looks to me like the bug we fixed in v3.2.3.

Indeed, it is fixed with last version !