summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-01 13:48:32 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-01 13:48:32 +0100
commit50c41d9bb2b1766feac984685bb2a954ab4799f3 (patch)
treedf15fd8557896511563928fe414073baf5c27751
parent8beb15460a3c55c37264fdf414e7dcf9ff4e2a62 (diff)
Détails multi-utilisateur
https://github.com/marienfressinaud/FreshRSS/issues/126
-rw-r--r--app/Controllers/usersController.php47
-rw-r--r--app/views/configure/archiving.phtml4
-rw-r--r--app/views/configure/feed.phtml4
-rw-r--r--app/views/configure/users.phtml9
-rw-r--r--p/themes/default/global.css2
-rw-r--r--p/themes/flat-design/global.css2
6 files changed, 28 insertions, 40 deletions
diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.php
index 0ce3b3447..482e35c3e 100644
--- a/app/Controllers/usersController.php
+++ b/app/Controllers/usersController.php
@@ -10,9 +10,10 @@ class FreshRSS_users_Controller extends Minz_ActionController {
}
}
- public function idAction() {
+ public function authAction() {
if (Minz_Request::isPost()) {
$ok = true;
+
$mail = Minz_Request::param('mail_login', false);
$this->view->conf->_mail_login($mail);
$ok &= $this->view->conf->save();
@@ -25,36 +26,24 @@ class FreshRSS_users_Controller extends Minz_ActionController {
@unlink($personaFile);
$ok &= (file_put_contents($personaFile, Minz_Session::param('currentUser', '_')) !== false);
}
- invalidateHttpCache();
- //TODO: use $ok
- $notif = array(
- 'type' => 'good',
- 'content' => Minz_Translate::t('configuration_updated')
- );
- Minz_Session::_param('notification', $notif);
-
- Minz_Request::forward(array('c' => 'configure', 'a' => 'users'), true);
- }
- }
-
- public function authAction() {
- if (Minz_Request::isPost() && Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) {
- $ok = true;
- $current_token = $this->view->conf->token;
- $token = Minz_Request::param('token', $current_token);
- $this->view->conf->_token($token);
- $ok &= $this->view->conf->save();
-
- $anon = Minz_Request::param('anon_access', false);
- $anon = ((bool)$anon) && ($anon !== 'no');
- $auth_type = Minz_Request::param('auth_type', 'none');
- if ($anon != Minz_Configuration::allowAnonymous() ||
- $auth_type != Minz_Configuration::authType()) {
- Minz_Configuration::_allowAnonymous($anon);
- Minz_Configuration::_authType($auth_type);
- $ok &= Minz_Configuration::writeFile();
+ if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) {
+ $current_token = $this->view->conf->token;
+ $token = Minz_Request::param('token', $current_token);
+ $this->view->conf->_token($token);
+ $ok &= $this->view->conf->save();
+
+ $anon = Minz_Request::param('anon_access', false);
+ $anon = ((bool)$anon) && ($anon !== 'no');
+ $auth_type = Minz_Request::param('auth_type', 'none');
+ if ($anon != Minz_Configuration::allowAnonymous() ||
+ $auth_type != Minz_Configuration::authType()) {
+ Minz_Configuration::_allowAnonymous($anon);
+ Minz_Configuration::_authType($auth_type);
+ $ok &= Minz_Configuration::writeFile();
+ }
}
+
invalidateHttpCache();
$notif = array(
diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml
index cbe3b086c..6e26ca81e 100644
--- a/app/views/configure/archiving.phtml
+++ b/app/views/configure/archiving.phtml
@@ -17,8 +17,8 @@
<div class="form-group">
<label class="group-name" for="keep_history_default"><?php echo Minz_Translate::t('keep_history'), ' ', Minz_Translate::t('by_feed'); ?></label>
<div class="group-controls">
- <select class="number" name="keep_history_default" id="keep_history_default"><?php
- foreach (array(-3 => '', 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) {
+ <select class="number" name="keep_history_default" id="keep_history_default" required="required"><?php
+ foreach (array('' => '', 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) {
echo '<option value="' . $v . ($this->conf->keep_history_default == $v ? '" selected="selected' : '') . '">' . $t . ' </option>';
}
?></select> (<?php echo Minz_Translate::t('by_default'); ?>)
diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml
index e738ab64f..a0fe39f8a 100644
--- a/app/views/configure/feed.phtml
+++ b/app/views/configure/feed.phtml
@@ -87,8 +87,8 @@
<div class="form-group">
<label class="group-name" for="keep_history"><?php echo Minz_Translate::t ('keep_history'); ?></label>
<div class="group-controls">
- <select class="number" name="keep_history" id="keep_history"><?php
- foreach (array(-3 => '', -2 => Minz_Translate::t('by_default'), 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) {
+ <select class="number" name="keep_history" id="keep_history" required="required"><?php
+ foreach (array('' => '', -2 => Minz_Translate::t('by_default'), 0 => '0', 10 => '10', 50 => '50', 100 => '100', 500 => '500', 1000 => '1 000', 5000 => '5 000', 10000 => '10 000', -1 => '∞') as $v => $t) {
echo '<option value="' . $v . ($this->flux->keepHistory() === $v ? '" selected="selected' : '') . '">' . $t . '</option>';
}
?></select>
diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml
index 223f81e8d..d40a3ad5b 100644
--- a/app/views/configure/users.phtml
+++ b/app/views/configure/users.phtml
@@ -3,7 +3,7 @@
<div class="post">
<a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t('back_to_rss_feeds'); ?></a>
- <form method="post" action="<?php echo _url('users', 'id'); ?>">
+ <form method="post" action="<?php echo _url('users', 'auth'); ?>">
<legend><?php echo Minz_Translate::t('login_configuration'); ?></legend>
<div class="form-group">
@@ -34,20 +34,19 @@
</div>
</div>
<?php } ?>
- </form>
<?php if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { ?>
- <form method="post" action="<?php echo _url('users', 'auth'); ?>">
<legend><?php echo Minz_Translate::t('auth_type'); ?></legend>
<div class="form-group">
<label class="group-name" for="auth_type"><?php echo Minz_Translate::t('auth_type'); ?></label>
<div class="group-controls">
- <select id="auth_type" name="auth_type">
+ <select id="auth_type" name="auth_type" required="required">
+ <option value=""></option>
<option value="none"<?php echo Minz_Configuration::authType() === 'none' ? ' selected="selected"' : ''; ?>><?php echo Minz_Translate::t('auth_none'); ?></option>
<option value="http_auth"<?php echo Minz_Configuration::authType() === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>>HTTP Auth</option>
- <option value="persona"<?php echo Minz_Configuration::authType() === 'persona' ? ' selected="selected"' : ''; ?>>Mozilla Persona</option>
+ <option value="persona"<?php echo Minz_Configuration::authType() === 'persona' ? ' selected="selected"' : '', $this->conf->mail_login == '' ? ' disabled="disabled"' : ''; ?>>Mozilla Persona</option>
</select>
<code>$_SERVER['REMOTE_USER'] = `<?php echo httpAuthUser(); ?>`</code>
</div>
diff --git a/p/themes/default/global.css b/p/themes/default/global.css
index 913da4b27..2cc195f90 100644
--- a/p/themes/default/global.css
+++ b/p/themes/default/global.css
@@ -112,7 +112,7 @@ input, select, textarea {
border-color: #33BBFF;
box-shadow: 0 2px 2px #DDDDFF inset;
}
- input:invalid {
+ input:invalid, select:invalid {
border-color: red;
box-shadow: 0 0 2px 1px red;
}
diff --git a/p/themes/flat-design/global.css b/p/themes/flat-design/global.css
index cb9495865..c24a9f481 100644
--- a/p/themes/flat-design/global.css
+++ b/p/themes/flat-design/global.css
@@ -113,7 +113,7 @@ input, select, textarea {
color: #333;
border-color: #2980b9;
}
- input:invalid {
+ input:invalid, select:invalid {
border-color: red;
box-shadow: 0 0 2px 1px red;
}