Logging In

Login Checklist

If you have recently upgraded to v2 of the elentra-developer environment, verify that your database hostname in www-root/core/config/config.inc.php is set to mariadb.

You can see the login page but receive a message stating that "An internal server error has occurred" or "The application credentials are incorrect for this system" every time you enter your login credentials.

With v2 of the elentra-developer Docker environment you can now access phpMyAdmin from http://localhost:3000 on your development machine.

Can you login via API directly?

The login form utilizes the API to authenticate users. Using a tool like Postman to test logging in directly via API is a very good way to get clarity where the error actually is. Moreover, the API will provide a better response regarding what the actual issue is.

  • Open Postman, and create a POST request to http://elentra-1x-me.localhost/api/v2/auth/login while passing the following data in the Body { "username": "admin", "password": "apple123", "auth_username": "[Your AUTH Username]", "auth_password": "[Your AUTH Password]", "auth_method": "local", "auth_app_id": 1 }

  • You should see helpful response identifying what the logging in issue is. If the response you receive isn't helpful, then please proceed with the checklist below.

Database

  • Database schema is created?

  • Database user exists?

  • Database user password is correct?

  • Database user has permissions to the schema? (try with full permissions, to make sure that permissions aren’t the issue, restrict afterwards)

  • Can you connect to the database with the MySQL command line (or a database GUI like phpMyAdmin) and view the tables of the database?

  • Is the character encoding/collation correct for the database and the DEFAULT_CHARSET in settings.inc.php? Mixing Latin1 and UTF8 can lead to problems. This may require adding debug statements or stepping through the login process, and checking variables/error messages.

Application

Verify the following in www-root/core/config/config.inc.php:

  • There is a row in [auth_schema].registered_apps where:

    1. script_id matches [“auth_username” in the config file]?

    2. script_password matches MD5([auth_password]) in the config file?

  • The AUTH_APP_ID defined in settings.inc.php is the same as [auth_schema].registered_apps.id? (Try putting Log::info($app_auth_credentials); after that variable is defined in the API’s AuthController.php postLogin() method to be sure.)

API

  • Is the API set up correctly (for a development environment, there may be a symbolic link in www-root/core/library/vendor/elentrapackages)? Make sure that the link is pointing to a valid API directory.

  • Is the API accessible? You should be able to go to [website url]/api/v2 and see the message “Welcome to the Elentra API. Please see our documentation for assistance.”. You can also use Postman to work directly with the API; that will often show additional information that may be helpful.

  • Is there a .htaccess file in your www-root folder?

  • If using different Elentra applications (i.e. Admissions, ME, CPD), is the API the correct version for the application version you are running? CPD may require a different API version from ME.

User

  • Is there a row in [auth_schema].user_data where:

    1. username matches the username in the login form?

    2. password matches the SHA1(login form password + salt from row)?

    3. organisation_id exists in [auth_schema].organisations?

    4. the app_id in [auth_schema].organisations matches the app_id in in [auth_schema].registered_apps?

  • Is there a row in [auth_schema].user_access where:

    1. user_id matches the id field in [auth_schema].user_data?

    2. app_id matches the id in [auth_schema].registered_apps?

    3. organisation_id matches the id in [auth_schema].user_data?

    4. account_active is true?

    5. access_starts is before now?

    6. access_expires is after now (or 0)?

    7. locked_out_until is NULL?

Organisation

  • Is the “organisation_id” set to the correct value in settings.inc.php?

  • Do the “AUTH_APP_ID” and “AUTH_APP_IDS_STRING” variables in settings.inc.php match the ID of a row in the [auth_schema].registered_apps table?

  • Are there entries in in [auth_schema].user_preferences for the “organisation_switcher” module that are pointing to the wrong organisation_id? These rows can safely be removed because they will be regenerated as needed (they determine which Organisation is the default for that user when logging in).

  • In the in [auth_schema].organisations table, is the template for this organisation set to a www-root/templatesdirectory that does not exist (e.g. if the DB has come from a live site that has a customized set of templates, and your development site doesn't have them)?

Logs

Be sure to check the following logs if you cannot see any errors or warnings being printed to the screen.

  • www-root/core/storage/logs/api.log

  • www-root/core/storage/logs/error_log

  • Apache logs (typically /var/log/httpd/error_log or /var/log/httpd/ssl_error_log)

If you are developing using a Docker container, ensure that you are checking the logs from inside the container, not the host operating system!

Other Debugging Tips

  • Enable Laravel debug messages (only for use in development) by running the following command from the root of your elentra-1x-me project.

    echo "APP_DEBUG=true" > www-root/core/library/vendor/elentrapackages/elentra-1x-api/.env

Last updated