summaryrefslogtreecommitdiff
path: root/app/install.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/install.php')
-rw-r--r--app/install.php52
1 files changed, 37 insertions, 15 deletions
diff --git a/app/install.php b/app/install.php
index 8986e9965..4449cd063 100644
--- a/app/install.php
+++ b/app/install.php
@@ -149,7 +149,7 @@ function saveStep2() {
$config_array = array(
'language' => $_SESSION['language'],
- 'theme' => $_SESSION['theme'],
+ 'theme' => 'Origine',
'old_entries' => $_SESSION['old_entries'],
'mail_login' => $_SESSION['mail_login'],
'passwordHash' => $_SESSION['passwordHash'],
@@ -307,6 +307,7 @@ function checkStep1() {
$log = LOG_PATH && is_writable(LOG_PATH);
$favicons = is_writable(DATA_PATH . '/favicons');
$persona = is_writable(DATA_PATH . '/persona');
+ $http_referer = is_referer_from_same_domain();
return array(
'php' => $php ? 'ok' : 'ko',
@@ -323,8 +324,10 @@ function checkStep1() {
'log' => $log ? 'ok' : 'ko',
'favicons' => $favicons ? 'ok' : 'ko',
'persona' => $persona ? 'ok' : 'ko',
+ 'http_referer' => $http_referer ? 'ok' : 'ko',
'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom &&
- $data && $cache && $log && $favicons && $persona ? 'ok' : 'ko'
+ $data && $cache && $log && $favicons && $persona && $http_referer ?
+ 'ok' : 'ko'
);
}
@@ -334,9 +337,15 @@ function checkStep2() {
isset($_SESSION['mail_login']) &&
!empty($_SESSION['default_user']);
- $form = $_SESSION['auth_type'] != 'form' || !empty($_SESSION['passwordHash']);
+ $form = (
+ isset($_SESSION['auth_type']) &&
+ ($_SESSION['auth_type'] != 'form' || !empty($_SESSION['passwordHash']))
+ );
- $persona = $_SESSION['auth_type'] != 'persona' || !empty($_SESSION['mail_login']);
+ $persona = (
+ isset($_SESSION['auth_type']) &&
+ ($_SESSION['auth_type'] != 'persona' || !empty($_SESSION['mail_login']))
+ );
$defaultUser = empty($_POST['default_user']) ? null : $_POST['default_user'];
if ($defaultUser === null) {
@@ -548,6 +557,12 @@ function printStep1() {
<p class="alert alert-error"><span class="alert-head"><?php echo _t('damn'); ?></span> <?php echo _t('file_is_nok', DATA_PATH . '/persona'); ?></p>
<?php } ?>
+ <?php if ($res['http_referer'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t('ok'); ?></span> <?php echo _t('http_referer_is_ok'); ?></p>
+ <?php } else { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t('damn'); ?></span> <?php echo _t('http_referer_is_nok'); ?></p>
+ <?php } ?>
+
<?php if ($res['all'] == 'ok') { ?>
<a class="btn btn-important next-step" href="?step=2"><?php echo _t('next_step'); ?></a>
<?php } else { ?>
@@ -591,16 +606,17 @@ function printStep2() {
<div class="form-group">
<label class="group-name" for="auth_type"><?php echo _t('auth_type'); ?></label>
<div class="group-controls">
- <select id="auth_type" name="auth_type" required="required" onchange="auth_type_change()">
+ <select id="auth_type" name="auth_type" required="required" onchange="auth_type_change(true)">
<?php
- function no_auth() {
- return !in_array($_SESSION['auth_type'], array('form', 'persona', 'http_auth', 'none'));
+ function no_auth($auth_type) {
+ return !in_array($auth_type, array('form', 'persona', 'http_auth', 'none'));
}
+ $auth_type = isset($_SESSION['auth_type']) ? $_SESSION['auth_type'] : '';
?>
- <option value="form"<?php echo $_SESSION['auth_type'] === 'form' || no_auth() ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo _t('auth_form'); ?></option>
- <option value="persona"<?php echo $_SESSION['auth_type'] === 'persona' ? ' selected="selected"' : ''; ?>><?php echo _t('auth_persona'); ?></option>
- <option value="http_auth"<?php echo $_SESSION['auth_type'] === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('http_auth'); ?>(REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option>
- <option value="none"<?php echo $_SESSION['auth_type'] === 'none' ? ' selected="selected"' : ''; ?>><?php echo _t('auth_none'); ?></option>
+ <option value="form"<?php echo $auth_type === 'form' || no_auth($auth_type) ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"'; ?>><?php echo _t('auth_form'); ?></option>
+ <option value="persona"<?php echo $auth_type === 'persona' ? ' selected="selected"' : ''; ?>><?php echo _t('auth_persona'); ?></option>
+ <option value="http_auth"<?php echo $auth_type === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('http_auth'); ?>(REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option>
+ <option value="none"<?php echo $auth_type === 'none' ? ' selected="selected"' : ''; ?>><?php echo _t('auth_none'); ?></option>
</select>
</div>
</div>
@@ -609,7 +625,7 @@ function printStep2() {
<label class="group-name" for="passwordPlain"><?php echo _t('password_form'); ?></label>
<div class="group-controls">
<div class="stick">
- <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" autocomplete="off" <?php echo $_SESSION['auth_type'] === 'form' ? ' required="required"' : ''; ?> />
+ <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" autocomplete="off" <?php echo $auth_type === 'form' ? ' required="required"' : ''; ?> />
<a class="btn toggle-password" data-toggle="passwordPlain"><?php echo FreshRSS_Themes::icon('key'); ?></a>
</div>
<noscript><b><?php echo _t('javascript_should_be_activated'); ?></b></noscript>
@@ -619,7 +635,7 @@ function printStep2() {
<div class="form-group">
<label class="group-name" for="mail_login"><?php echo _t('persona_connection_email'); ?></label>
<div class="group-controls">
- <input type="email" id="mail_login" name="mail_login" value="<?php echo isset($_SESSION['mail_login']) ? $_SESSION['mail_login'] : ''; ?>" placeholder="alice@example.net" <?php echo $_SESSION['auth_type'] === 'persona' ? ' required="required"' : ''; ?> />
+ <input type="email" id="mail_login" name="mail_login" value="<?php echo isset($_SESSION['mail_login']) ? $_SESSION['mail_login'] : ''; ?>" placeholder="alice@example.net" <?php echo $auth_type === 'persona' ? ' required="required"' : ''; ?> />
<noscript><b><?php echo _t('javascript_should_be_activated'); ?></b></noscript>
</div>
</div>
@@ -644,7 +660,7 @@ function printStep2() {
toggles[i].addEventListener('click', toggle_password);
}
- function auth_type_change() {
+ function auth_type_change(focus) {
var auth_value = document.getElementById('auth_type').value,
password_input = document.getElementById('passwordPlain'),
mail_input = document.getElementById('mail_login');
@@ -652,15 +668,21 @@ function printStep2() {
if (auth_value === 'form') {
password_input.required = true;
mail_input.required = false;
+ if (focus) {
+ password_input.focus();
+ }
} else if (auth_value === 'persona') {
password_input.required = false;
mail_input.required = true;
+ if (focus) {
+ mail_input.focus();
+ }
} else {
password_input.required = false;
mail_input.required = false;
}
}
- auth_type_change();
+ auth_type_change(false);
</script>
<div class="form-group form-actions">