Merge branch 'bugfix/Prettify-page-layout-when-accessing-a-non-existent-route-while-not-being-authenticated-10009'

fixes #10009
This commit is contained in:
Johannes Meyer 2015-09-28 09:57:27 +02:00
commit ee7e7a1a78
8 changed files with 82 additions and 59 deletions

View File

@ -35,6 +35,10 @@ class ErrorController extends ActionController
Logger::error($exception);
Logger::error('Stacktrace: %s', $exception->getTraceAsString());
if (! ($isAuthenticated = $this->Auth()->isAuthenticated())) {
$this->innerLayout = 'error';
}
switch ($error->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
@ -45,11 +49,13 @@ class ErrorController extends ActionController
$path = array_shift($path);
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = $this->translate('Page not found.');
if ($this->Auth()->isAuthenticated() && $modules->hasInstalled($path) && ! $modules->hasEnabled($path)) {
$this->view->message .= ' ' . sprintf(
$this->translate('Enabling the "%s" module might help!'),
$path
);
if ($isAuthenticated) {
if ($modules->hasInstalled($path) && ! $modules->hasEnabled($path)) {
$this->view->message .= ' ' . sprintf(
$this->translate('Enabling the "%s" module might help!'),
$path
);
}
}
break;
@ -93,5 +99,6 @@ class ErrorController extends ActionController
}
$this->view->request = $error->request;
$this->view->hideControls = ! $isAuthenticated;
}
}

View File

@ -0,0 +1,8 @@
<div class="logo">
<div class="image">
<img aria-hidden="true" src="<?= $this->baseUrl('img/logo_icinga_big.png'); ?>" alt="<?= $this->translate('The Icinga logo'); ?>" >
</div>
</div>
<div class="below-logo">
<?= $this->render('inline.phtml') ?>
</div>

View File

@ -4,7 +4,7 @@
<img aria-hidden="true" class="fade-in one" src="<?= $this->baseUrl('img/logo_icinga_big.png'); ?>" alt="<?= $this->translate('The Icinga logo'); ?>" >
</div>
</div>
<div class="form" data-base-target="layout">
<div class="below-logo" data-base-target="layout">
<h1><?= $this->translate('Welcome to Icinga Web 2'); ?></h1>
<?php if ($requiresSetup): ?>
<p class="config-note"><?= sprintf(

View File

@ -1,10 +1,12 @@
<?php if (! $hideControls): ?>
<div class="controls">
<?= $this->tabs->showOnlyCloseButton() ?>
<?= $tabs->showOnlyCloseButton(); ?>
</div>
<div class="content">
<p><strong><?= nl2br($this->escape($message)) ?></strong></p>
<?php if (isset($stackTrace)) : ?>
<hr />
<pre><?= $this->escape($stackTrace) ?></pre>
<?php endif ?>
</div>
<div class="content">
<p><strong><?= nl2br($this->escape($message)); ?></strong></p>
<?php if (isset($stackTrace)): ?>
<hr />
<pre><?= $this->escape($stackTrace) ?></pre>
<?php endif ?>
</div>

View File

@ -28,6 +28,7 @@ class StyleSheet
'css/icinga/pagination.less',
'css/icinga/selection-toolbar.less',
'css/icinga/login.less',
'css/icinga/logo.less',
'css/icinga/controls.less'
);

View File

@ -280,14 +280,7 @@ html {
}
#login {
.logo .image img {
width: 70%;
}
.form {
width: 100%;
margin: auto;
}
.form label {
.below-logo label {
width: 100%;
margin: 0;
text-align: center;

View File

@ -4,47 +4,12 @@
width: 100%;
height: 100%;
.logo {
background-color: @colorPetrol;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 60%;
border-bottom: 1px solid #d9d9d9d;
text-align: center;
-webkit-box-shadow: 0 3px 7px -3px #000;
-moz-box-shadow: 0 3px 7px -3px #000;
box-shadow: 0 3px 7px -3px #000;
}
.image {
position: absolute;
bottom: 1em;
left: 0px;
right: 0px;
text-align: center;
}
.error {
margin-left:auto;
margin-right:auto;
}
.image img {
width: 375px;
}
.form {
position: absolute;
font-size: 0.9em;
top: 45%;
left: 0;
bottom: 0;
right: 0;
}
.form h1 {
.below-logo h1 {
text-align: center;
font-size: 1.5em;
margin-left: 2.3em;
@ -53,7 +18,7 @@
font-variant: unset;
}
.form div.element {
.below-logo div.element {
margin: 0;
ul.errors {
@ -61,7 +26,7 @@
}
}
.form label {
.below-logo label {
font-weight: normal;
display: inline-block;
line-height: 2.5em;

View File

@ -0,0 +1,47 @@
/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
.logo {
background-color: @colorPetrol;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 60%;
border-bottom: 1px solid #d9d9d9d;
text-align: center;
-webkit-box-shadow: 0 3px 7px -3px #000;
-moz-box-shadow: 0 3px 7px -3px #000;
box-shadow: 0 3px 7px -3px #000;
.image {
position: absolute;
bottom: 1em;
left: 0px;
right: 0px;
text-align: center;
img {
width: 375px;
}
}
}
.below-logo {
position: absolute;
font-size: 0.9em;
top: 45%;
left: 0;
bottom: 0;
right: 0;
}
#layout.minimal-layout {
.logo .image img {
width: 70%;
}
.below-logo {
width: 100%;
margin: auto;
}
}