Logout Button Logging out, but not redirecting

I’m sure this is a case of me being an idiot, but I’m at a loss.

I followed these instructions to create a logout button:

Logging out works (if I refresh the page, I go to the login page because I’m not longer authenticated), but the user isn’t redirected to the login.html page. It appears that nothing happens. (but again, logging out does work).

I currently have the logout button in a header/site include, but the same thing happens when I add a button to the main page.

Here’s the code of the header and logout button (the header is a .php, and the main page is a .php).

<div is="dmx-browser" id="browser2"></div>
<dmx-serverconnect id="header_serverConnect" url="/dmxConnect/api/Security/dbLogout.php" noload="noload" dmx-on:success="browser2.goto('login.html')"></dmx-serverconnect>
<header class="">
  <div class="container h-auto">
        <div class="row align-items-xl-center border-bottom mt-xl-2 mb-xl-4">
          <div class="col-xl-1">
            <img src="/images/TK-Transparent-Background.png" class="w-100 d-none d-xl-inline">
          </div>
          <div class="col">
            <h1 class="">Identity and Access Management</h1>
          </div>
          <div class="col-xl-3 align-self-xl-center">
            <div class="row align-items-xl-center">
              <div class="col text-xl-center">
                <button class="btn w-75 text-xl-center bg-primary">Home</button>
              </div>
              <div class="col text-xl-center">
                <button class="btn text-xl-center w-75 bg-primary" dmx-on:click="header_serverConnect.load({})" id="btn_logout">Logout</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </header>

Any help is appreciated.

Thanks,
John

Hello John,
The code looks fine. Can you send a link to your page with explanation how to test it, so we can test it?

Yeah, it’s a live site, but barebones right now, so I don’t mind sharing login info.

https://dev.iam.tkschools.org

Username: jdombrowski
Password: all the kings

I’ll change the password when we are done.

If you need anyhting else, let me know. I really appreciate the quick help. I’m using Wappler 1.9.9 hosted on an Apache server.

John

header_serverConnect returns a 500 error, you need to enable debug to see the error.

1 Like

How to enable debug:

Okay, I have debug enabled and see the 500 internal error, this means it’s a server side thing even though it technically does log me out. I’ll look into that.

Thanks for pointing me in the right direction.

The error i see, returned by your server is:

message: “strtotime(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone ‘UTC’ for now, but please set date.timezone to select your timezone.”

This issue happens when a default time zone isn’t set in php.ini
You can add date.timezone 'Region/Zone' directly in php.ini file, here is a list of the valid timezones in PHP: http://php.net/manual/en/timezones.php

4 Likes

Yeah, I saw that. I’m working on fixing it.

Thanks again for the quick help. This is my second problem that’s been related to insufficient setup on my webserver (though I did learn about debugging this time!).

You guys are awesome!

Edit: Setting the timezone definitely resolved the issue. Thanks again, very happy I purchased this product (for both it’s capabilities and the support that’s provided)

1 Like

Just spent 6 hours on the same issue. glad i found this! Logout was broken remember me wasn’t working…

put

php_value date.timezone ‘region/zone’

in htaccess file. done :slight_smile:

1 Like

This post is still useful, just had the timezone error using date formatters on an old production server. Glad I found this! :blush: