Announcement

Collapse
No announcement yet.

Cannot login to espocrm

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot login to espocrm

    There is a problem with my espocrm installation I have been running for many years without problems: recently I cannot login to my website.

    I enter the correct credentials, then I get a 401 unauthorized (F12 developer options).
    The errormessage on the webpage is: Invalid username/password.
    There is NO errormessage about this in data/logs.
    The apache access log says:
    Code:
    x.x.x.x (ip) username 10/May/2022:20:52:55 +0200] "GET /api/v1/App/user HTTP/1.1" 401 -
    This is strange because I haven't changed my password at all so there is no reason for it to become invalid.

    When I try to request a new password via the login page > reset password link, I enter username + emailaddress and then I get a 403 error when calling passwordChangeRequest.
    data/logs says:
    Code:
    [2022-05-10 18:57:39] WARNING: Password recovery: User 1 is not active. [] []
    [2022-05-10 18:57:39] ERROR: (403) POST /User/passwordChangeRequest; line: 304, file: /path/to/espocrm/application/Espo/Core/Password/Recovery.php [] []
    apache access log:
    Code:
    [10/May/2022:20:57:39 +0200] "POST /api/v1/User/passwordChangeRequest HTTP/1.1" 403 -
    I'm pretty sure the error is incorrect, because my user 1 is active: I queried the database with phpmyadmin and my user column is_active = 1.
    Nevertheless, I tried to reset my password via CLI:
    Code:
    php command.php SetPassword USERNAME
    -> Resetting the password this way works, when I query the user table in the database, I see that the password hash has changed.

    However, when I login with these new credentials, login fails identically.

    Apart from that, I also get the following errors in data/log:
    Code:
    [2022-05-10 19:05:06] ERROR: CronManager: Failed job running, job [627ab6527b42d4787]. Error Details: Job CheckInboundEmails 601fe82127875b14c: [500] Group Email Account 601fe82127875b14c is not active. at /path/to/espocrm/application/Espo/Modules/Crm/Jobs/CheckInboundEmails.php:74 [] []
    [2022-05-10 19:05:06] ERROR: CronManager: Failed job running, job [627ab6527c605eaa7]. Error Details: Job CheckEmailAccounts 5820d52924531fb03: [500] Email Account 5820d52924531fb03 is not active. at /path/to/espocrm/application/Espo/Modules/Crm/Jobs/CheckEmailAccounts.php:74 [] []
    Also: strange: I have never disabled these accounts. Again, I assume these errors are false positives and some code is failing to run and throwing these errors as a result.
    Additionally: when I try to fsockopen() via a PHP script and run this via commandline, I can successfully connect to the mail server.


    System details:
    Arch linux: Linux 5.17.5-arch1-1 EspoCRM Forum SMP PREEMPT Wed, 27 Apr 2022 20:56:11 +0000 x86_64 GNU/Linux
    MariaDB 10.7.3 database server
    Apache/2.4.53 (Unix) - Mar 15 2022 01:43:41
    PHP 8.1.5 (cli) (built: Apr 14 2022 18:36:20) (NTS) / Zend Engine v4.1.5, Copyright (c) Zend Technologies
    Last edited by SpeedBullet; 05-10-2022, 07:19 PM.

  • #2
    Did you change something in your environment before the issue happened? What EspoCRM version do you have? Maybe MariaDB version was updated?
    Last edited by yuri; 05-11-2022, 07:26 AM.

    Comment


    • #3
      I suspect the problem is happening here https://github.com/espocrm/espocrm/b...ntity.php#L516

      PDO (or database) returned some value that is not listed in this check.

      Comment


      • #4
        Originally posted by yuri View Post
        I suspect the problem is happening here https://github.com/espocrm/espocrm/b...ntity.php#L516

        PDO (or database) returned some value that is not listed in this check.
        The value for "is_active" = 1 so the check should pass. It seems to me the platform cannot connect to the database. Is there any way I can increase loglevels to get more info? Problem is that the "login" action doesn't return anything at the moment.

        Comment


        • #5
          Hi SpeedBullet,

          I just tested the newest EspoCRM with the same requirements:
          • EspoCRM 7.1.4
          • PHP 8.1.5
          • MariaDB 10.7.3
          Everything works as expected: passwords are changed, cron works fine and the processes are started.

          Can you remember what actions you performed before the error appeared? Have there been any changes to the EspoCRM code? Perhaps some files got corrupted?
          The problem can also occur if you have an outdated version of EspoCRM.

          Comment


          • #6
            I haven't updated espocrm in a while. How to find out which version of espocrm is running (knowing I can't log in but I have acces to the database)?
            *edit: I checked data/config.php and there it says 'version' => '6.1.8', is this accurate or might that not include more recent updates?

            Also, there has been a system update which includes a newer php version. Since which espocrm version is php 8.1.5 supported? Maybe a system update caused this. The previous PHP version was php-8.0.13 (in use since november 2021 and able to use espocrm until april) and all was working well.

            *edit2: can I update with the commandline now that my setup is more or less broken? Would that destroy the compatibility with my plugins (e.g. sales plugin for making invoices). The plugin was installed +- one year ago.
            Last edited by SpeedBullet; 05-12-2022, 06:49 PM.

            Comment


            • #7
              Updated from 6.1.8 -> 6.1.10.
              The next upgrade to 7.0.10 failed because as I suspected, the advanced pack + sales pack are no longer compatible.

              Code:
              Current version is 6.1.10.
              EspoCRM will be upgraded to version 7.0.10 now. Enter [Y] to continue.
              y
              Downloading...
              Upgrading... This may take a while.......
              Error: EspoCRM 7.0 is not compatible with 'Advanced Pack' extension of a version lower than 2.8.0. Please upgrade the extension or uninstall it. Then run the upgrade command again.
              
              EspoCRM 7.0 is not compatible with 'Sales Pack' extension of a version lower than 1.1.4. Please upgrade the extension or uninstall it. Then run the upgrade command again.
              Also, upgrading to 6.1.10 didn't help to fix the problems, I still get the same symptoms as in my first post. Is this still a version issue? Is 6.1.10 not compatible with php 8.1.5?

              Comment


              • #8
                Ok, set my configfile to loglevel INFO and got the following error when trying to log in:
                Code:
                [2022-05-12 19:37:43] INFO: AUTH: Trying to login as user 'myusername' which is not active. [] []
                when I query for myusername in the USER table, is_active = 1... so what could be going on? I must be missing something obvious.

                I get into this code section of Authentication.php:
                Code:
                protected function processUserCheck(User $user, ?AuthLogRecord $authLogRecord) : bool
                {
                if (!$user->isActive()) {
                $GLOBALS['log']->info(
                "AUTH: Trying to login as user '".$user->get('userName')."' which is not active."
                );
                ...
                How to proceed?
                Last edited by SpeedBullet; 05-12-2022, 08:28 PM.

                Comment


                • #9
                  Originally posted by yuri View Post
                  I suspect the problem is happening here https://github.com/espocrm/espocrm/b...ntity.php#L516

                  PDO (or database) returned some value that is not listed in this check.
                  Retraced my steps and looked into this... low and behold, this was exactly true... how is this possible? It used to work in the past.

                  I changed this code:
                  Code:
                  case self::BOOL:
                  $value = ($value === 'true' || $value === '1' || $value === true);
                  to this:
                  Code:
                  case self::BOOL:
                  $value = ($value === 'true' || $value === '1' || $value === true || $value === 1);
                  and I can now login! I'll report back if I get more errors, because I fear I might have just fixed the tip of the iceberg. Why could I login in the past and now not anymore? Codewise an integer was not yet supported but my database already contained integers... how is that possible?


                  Also, the issue of upgrading remains. I currently have: Advanced pack 2.7.5 + Sales Pack 1.0.13. The upgrade-procedure suggests uninstalling these for compatibility reasons... will that mean I will lose invoice-capabilities?
                  Last edited by SpeedBullet; 05-12-2022, 08:57 PM.

                  Comment


                  • #10
                    > Why could I login in the past and now not anymore?

                    Your PHP version was upgraded. My first question was what EspoCRM version as it was important to know. Spent almost a day trying to find out where's the problem,

                    Please don't upgrade PHP or MardiaDB versions w/o upgrading EspoCRM to the version that supports those versions.

                    > will that mean I will lose invoice-capabilities?

                    Invoices is a part of sales pack, so, yes.
                    Last edited by yuri; 05-13-2022, 06:59 AM.

                    Comment


                    • #11
                      SpeedBullet,

                      I'm glad you were able to log in. And I really hope that the small code correction you made will not prevent you from working with EspoCRM.

                      Just in case, make an export of the records you need that are associated with extensions. Usually, after removing the extension, they are still stored in the database, but your situation is special, so it's not worth the risk.
                      For example, in the latest versions of EspoCRM, you don't need to delete an extension to update it.

                      I strongly ask you to update EspoCRM on time, just like all extensions. This is very important, in each update important things change, which are interdependent with the PHP version in particular.
                      Last edited by lazovic; 05-13-2022, 06:36 AM.

                      Comment


                      • #12
                        Don't worry I still love espocrm. I'm happy to report that everything is still working as it should, so that code change (+ cache clear) was all that was required to get back on track.

                        The only thing that does bum me out a little bit is the fact that I need to uninstall the extensions I purchased in order to be able to upgrade. That doesn't feel right that I can't at least keep the functionality these extensions provide, and I'm glad to read that uninstalling will not be required anymore with the latest versions. I use espocrm also for invoicing and it feels dangerous to know that functionality might be threatened by future updates.

                        Comment

                        Working...
                        X