Fix WelcomePage
There were some grammar- and layout-errors as well as information missing :(
This commit is contained in:
parent
c6b18d2f3d
commit
32006420c5
|
@ -6,7 +6,6 @@ namespace Icinga\Form\Setup;
|
|||
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Web\Form;
|
||||
use Icinga\Web\Form\Element\Note;
|
||||
use Icinga\Web\Form\Validator\TokenValidator;
|
||||
|
||||
/**
|
||||
|
@ -14,13 +13,6 @@ use Icinga\Web\Form\Validator\TokenValidator;
|
|||
*/
|
||||
class WelcomePage extends Form
|
||||
{
|
||||
/**
|
||||
* The configuration directory displayed to the user in the "generate security token" infobox
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $configDir = '/etc/icingaweb';
|
||||
|
||||
/**
|
||||
* Initialize this page
|
||||
*/
|
||||
|
@ -28,7 +20,6 @@ class WelcomePage extends Form
|
|||
{
|
||||
$this->setName('setup_welcome');
|
||||
$this->setViewScript('form/setup-welcome.phtml');
|
||||
$this->configDir = preg_replace('_/$_', '', Icinga::app()->getConfigDir());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,7 +34,8 @@ class WelcomePage extends Form
|
|||
'required' => true,
|
||||
'label' => t('Setup Token'),
|
||||
'description' => t(
|
||||
'For security reasons, we need to check that you are permitted to execute this setup. Please provide the token from the file "setup.token".'
|
||||
'For security reasons we need to ensure that you are permitted to run this wizard.'
|
||||
. ' Please provide a token by following the instructions below.'
|
||||
),
|
||||
'validators' => array(new TokenValidator(Icinga::app()->getConfigDir() . '/setup.token'))
|
||||
)
|
||||
|
|
|
@ -1,74 +1,75 @@
|
|||
<?php
|
||||
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Application\Platform;
|
||||
use Icinga\Web\Wizard;
|
||||
$setupToken = $this->form->configDir . '/setup.token';
|
||||
|
||||
$setupTokenPath = rtrim(Icinga::app()->getConfigDir(), '/') . '/setup.token';
|
||||
|
||||
?>
|
||||
|
||||
<form style="margin-top: 4em;" id="<?= $form->getName(); ?>" name="<?= $form->getName(); ?>" enctype="<?= $form->getEncType(); ?>" method="<?= $form->getMethod(); ?>" action="<?= $form->getAction(); ?>">
|
||||
<h2><?= t('Welcome to the installation of Icinga Web 2!') ?></h2>
|
||||
|
||||
<!-- TODO: Remove this once we release the first public version -->
|
||||
<div style="border:1px solid #777;border-radius:1em;background-color:beige;padding:1em;margin-bottom:1em;display:inline-block;">
|
||||
Icinga Web 2 is still in development and not meant for production deployment.
|
||||
Watch the <a href="https://dev.icinga.org/projects/icingaweb2/roadmap">development roadmap</a> and
|
||||
<a href="https://www.icinga.org/">Icinga website</a> for release schedule updates!
|
||||
</div>
|
||||
|
||||
<div class="info">
|
||||
<p>
|
||||
<?= sprintf(
|
||||
t(
|
||||
'Icinga Web 2 is the next generation monitoring web interface,'
|
||||
. ' framework and CLI tool developed by the %s.'
|
||||
),
|
||||
'<a href="https://www.icinga.org/community/team/">' . t('Icinga Project') . '</a>'
|
||||
); ?>
|
||||
</p>
|
||||
<p><?= t('Responsive and fast, rewritten from scratch supporting multiple backends and providing a CLI tool. ' .
|
||||
' Compatible with Icinga Core 2.x and 1.x.') ?>
|
||||
</p>
|
||||
<p>
|
||||
<?= sprintf(
|
||||
t('Check the Icinga website for some %s.', 'setup.welcome.screenshots'),
|
||||
'<a href="https://www.icinga.org/icinga/screenshots/icinga-web-2/">'
|
||||
. t('insights', 'setup.welcome.screenshots.label') . '</a>'
|
||||
) ?>
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
<?= t('This wizard will guide you through the installation of Icinga Web 2. Once completed and successfully ' .
|
||||
'finished you are able to log in and to explore all the new and stunning features!') ?>
|
||||
</p>
|
||||
<?= $form->getElement('token') ?>
|
||||
<?= $form->getElement($form->getTokenElementName()) ?>
|
||||
<?= $form->getElement($form->getUidElementName()) ?>
|
||||
<div class="welcome-page">
|
||||
<h2><?= t('Welcome to the installation of Icinga Web 2!') ?></h2>
|
||||
<!-- TODO: Remove this once we release the first public version -->
|
||||
<div style="border:1px solid #777;border-radius:1em;background-color:beige;padding:1em;margin-bottom:1em;display:inline-block;">
|
||||
Icinga Web 2 is still in development and not meant for production deployment.
|
||||
Watch the <a href="https://dev.icinga.org/projects/icingaweb2/roadmap">development roadmap</a> and
|
||||
<a href="https://www.icinga.org/">Icinga website</a> for release schedule updates!
|
||||
</div>
|
||||
<div class="info">
|
||||
<p><?= sprintf(
|
||||
t(
|
||||
'Icinga Web 2 is the next generation monitoring web interface,'
|
||||
. ' framework and CLI tool developed by the %s.'
|
||||
),
|
||||
'<a href="https://www.icinga.org/community/team/">' . t('Icinga Project') . '</a>'
|
||||
); ?></p>
|
||||
<p><?= t(
|
||||
'Responsive and fast, rewritten from scratch supporting multiple backends and'
|
||||
. ' providing a CLI tool. Compatible with Icinga Core 2.x and 1.x.'
|
||||
); ?></p>
|
||||
<p><?= sprintf(
|
||||
t('Check the Icinga website for some %s.', 'setup.welcome.screenshots'),
|
||||
'<a href="https://www.icinga.org/icinga/screenshots/icinga-web-2/">'
|
||||
. t('insights', 'setup.welcome.screenshots.label') . '</a>'
|
||||
); ?></p>
|
||||
</div>
|
||||
<p><?= t(
|
||||
'This wizard will guide you through the installation of Icinga Web 2. Once completed and successfully'
|
||||
. ' finished you are able to log in and to explore all the new and stunning features!'
|
||||
); ?></p>
|
||||
<form id="<?= $form->getName(); ?>" name="<?= $form->getName(); ?>" enctype="<?= $form->getEncType(); ?>" method="<?= $form->getMethod(); ?>" action="<?= $form->getAction(); ?>">
|
||||
<?= $form->getElement('token'); ?>
|
||||
<?= $form->getElement($form->getTokenElementName()); ?>
|
||||
<?= $form->getElement($form->getUidElementName()); ?>
|
||||
<div class="buttons">
|
||||
<?php
|
||||
echo $form->getElement(Wizard::BTN_NEXT);
|
||||
?>
|
||||
<?= $form->getElement(Wizard::BTN_NEXT); ?>
|
||||
</div>
|
||||
<br>
|
||||
</form>
|
||||
|
||||
|
||||
<div style="border-radius: 0.2em; margin: auto; margin-top: 3em; text-align: center; max-width: 46em; border: 1px solid #eeeeee;">
|
||||
<div style="border-radius: 0.2em; padding: 0.1em; background-color: #eeeeee; ">
|
||||
<img style="float: right;" src="<?= $this->href('img/icons/comment.png') ?>"/>
|
||||
Generating a new Security Token:
|
||||
</form>
|
||||
<div class="note">
|
||||
<div class="title">
|
||||
<img src="<?= $this->href('img/icons/comment.png'); ?>" alt="<?= t('Note'); ?>">
|
||||
<strong>Generating a New Setup Token</strong>
|
||||
</div>
|
||||
<div>
|
||||
<p style="margin: 1em">
|
||||
<?= t('As the Icinga Web 2 administrator you need set a security token, so the installer can authorize its user:') ?>
|
||||
</p>
|
||||
<span class="code"> sudo icingacli setup generateToken </span>
|
||||
<p style="margin: 1em">
|
||||
<?= t('If you don\'t have IcingaCLI available, you can set it yourself:') ?>
|
||||
</p>
|
||||
<span class="code">
|
||||
head -c 12 /dev/urandom | base64 | sudo -u 'apache' tee <?= $setupToken ?>; <br/>
|
||||
sudo chmod 0660 <?= $setupToken ?>; <br/>
|
||||
</span> <br/>
|
||||
<p>
|
||||
<?= t('For further help, please check out the <a href="#">IcingaWeb2 Documentation</a> on this topic.') ?>
|
||||
</p>
|
||||
<p><?=
|
||||
t('To run this wizard a user needs to authenticate using a token which is usually'
|
||||
. ' provided to him by an administrator who\'d followed the instructions below.'
|
||||
); ?></p>
|
||||
<p><?= t('If you\'ve got the IcingaCLI installed you can do the following:'); ?></p>
|
||||
<div class="code">
|
||||
<span>sudo icingacli setup createConfigDirectory <?= Platform::getPhpUser(); ?>;</span>
|
||||
<span>sudo icingacli setup generateToken;</span>
|
||||
</div>
|
||||
<p><?= t('In case the IcingaCLI is missing you can create the token manually:'); ?></p>
|
||||
<div class="code">
|
||||
<span>sudo mkdir -m 2775 <?= dirname($setupTokenPath); ?> && sudo chgrp <?= Platform::getPhpUser(); ?> <?= dirname($setupTokenPath); ?>;</span>
|
||||
<span>head -c 12 /dev/urandom | base64 | sudo -u '<?= Platform::getPhpUser(); ?>' tee <?= $setupTokenPath; ?>;</span>
|
||||
<span>sudo chmod 0660 <?= $setupTokenPath; ?>;</span>
|
||||
</div>
|
||||
<p style="font-size: 85%;"><?= sprintf(
|
||||
t('Please see the %s for an extensive description on how to access and use this wizard.'),
|
||||
'<a href="http://docs.icinga.org/">' . t('Icinga Web 2 documentation') . '</a>'
|
||||
); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -141,6 +141,21 @@ class Platform
|
|||
return phpversion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the username PHP is running as
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getPhpUser()
|
||||
{
|
||||
if (static::isWindows()) {
|
||||
return get_current_user(); // http://php.net/manual/en/function.get-current-user.php#75059
|
||||
}
|
||||
|
||||
$userInfo = posix_getpwuid(posix_geteuid());
|
||||
return $userInfo['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for php extension
|
||||
*
|
||||
|
|
|
@ -290,7 +290,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
#setup_welcome {
|
||||
.welcome-page {
|
||||
margin-top: 3em;
|
||||
text-align: center;
|
||||
|
||||
h2 {
|
||||
|
@ -304,6 +305,45 @@
|
|||
background-color: #eee;
|
||||
border: 1px solid lightgrey;
|
||||
}
|
||||
|
||||
div.note {
|
||||
width: 40%;
|
||||
padding: 1em;
|
||||
margin: 3em auto 0;
|
||||
text-align: left;
|
||||
border-radius: 0.5em;
|
||||
border: 1px solid #eee;
|
||||
|
||||
div.title {
|
||||
padding: 0.2em;
|
||||
margin: -1em -1em 1em;
|
||||
text-align: center;
|
||||
background-color: #eee;
|
||||
border-top-left-radius: 0.5em;
|
||||
border-top-right-radius: 0.5em;
|
||||
}
|
||||
|
||||
img {
|
||||
float: right;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 2em 0 1em 0;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
div.code {
|
||||
margin: 0 2em;
|
||||
|
||||
span {
|
||||
display: block;
|
||||
font-family: monospace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#setup {
|
||||
|
@ -373,12 +413,3 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.code {
|
||||
font-family: monospace;
|
||||
display: inline-block;
|
||||
padding: 1 1em;
|
||||
border-radius: 1em;
|
||||
min-width: 42em;
|
||||
text-align: left;
|
||||
}
|
Loading…
Reference in New Issue