Problems login in after emonCMS update due to the email_verified column in users table

Hi,

Yesterday I updated my emonCMS that I use for MyHomeEnergyPlanner and today when trying to log in I couldn’t, I got in the login box the following message: Database error, you may need to run database update

Digging into the error this waw the MySQL error: Unknown column ‘email_verified’ in ‘field list’.

Looking into the code I found what the problem is emoncms/user_model.php at master · emoncms/emoncms · GitHub

To log in we are trying to fetch the column “email_verified” but that column doesn’t exist in my database yet. Also because I can’t login I can’t update the database. I have sorted it adding the column with phpMyAdmin.

I am posting it here because I am sure more than one will have the same problem unless they are already logged in when they update emonCMS and they do the database update straight away.

Thanks Carlos.

EmonPi installs will automatically call database update during the update process. For other installations its possible to enable a special update login by adding the line:

$updatelogin = true;

to settings.php.

You can then navigate to /emoncms/admin/db to run the update:

1 Like

I should add, after completing the update remove the line:

$updatelogin = true;

or set to false and verify you are not able to access /emoncms/admin/db while logged out again.

Would it not be useful to add $updatelogin = false;to the default settings file with an explanation of what it’s for and why it must always be set back to false after use. This would not only make the function more accessible, but also protect against users “just adding it” to the settings file and forgetting to set it back to false after forgetting it’s purpose further down the line.

[edit] or add $updatelogin = true;` commented out with a note?

1 Like

Yes good idea

I’ve added it to the default settings file and also restricted access to database update specifically to make this more secure, now available in the master branch: include db update login bypass setting in settings.php · emoncms/emoncms@559c9d6 · GitHub

Thank you @TrystanLea for the detailed answer. Good to see everything is under control

I solved the same error (but may be a different problem) using this solution (which IMHO is better than fiddling with the settings.php file). Perhaps that php file can be made available in the main emoncms repo so it can be run from the command line?

1 Like