Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Added workaround to avoid showing pre-loaded main page after logout, f…
Browse files Browse the repository at this point in the history
…ixes #174.

The workaround classifies the link to the main page as "external", making a reload necessary. The real solution is to migrate the app to a single-page app.
  • Loading branch information
rvolz committed Sep 30, 2015
1 parent 9d164cb commit 6c5f709
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
21 changes: 16 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,15 @@ function perform_login() {
} else {
$app->login_service->login($app->auth, array('username' => $uname, 'password' => $upw));
$success = $app->auth->getStatus();
$app->getLog()->debug('login success: ' . var_export($success, true));
if ($app->auth->isValid())
$app->getLog()->debug('login success: ' . $success);
if ($app->auth->isValid()) {
$app->getLog()->info('logged in user : ' . $app->auth->getUserName());
$app->redirect($app->request->getRootUri().'/');
else
} else {
$app->getLog()->error('error logging in user : ' . $login_data['username']);
$app->render('login.html', array(
'page' => mkPage(getMessageString('login'))));
'page' => mkPage(getMessageString('login'))));
}
}
} else {
$app->render('login.html', array(
Expand All @@ -250,8 +253,16 @@ function perform_login() {

function logout() {
global $app;
if ($app->auth->isValid())
if ($app->auth->isValid()) {
$username = $app->auth->getUserName();
$app->getLog()->debug("logging out user: " . $username);
$app->logout_service->logout($app->auth);
if ($app->auth->isValid()) {
$app->getLog()->error("error logging out user: " . $username);
} else {
$app->getLog()->info("logged out user: " . $username);
}
}
$app->render('logout.html', array(
'page' => mkPage(getMessageString('logout'))));
}
Expand Down
3 changes: 2 additions & 1 deletion templates/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<div data-role="navbar">
<ul>
<li>
<a href="{{page.rot}}/" data-icon="home" {% if page.menu== 1 %}class="ui-btn-active" {%endif%}>
<a href="{{page.rot}}/" data-icon="home" data-rel="external" {% if page.menu== 1 %}class="ui-btn-active"
{%endif%}>
{{page.glob.l10n.home}}
</a>
</li>
Expand Down

0 comments on commit 6c5f709

Please sign in to comment.