aboutsummaryrefslogtreecommitdiff
path: root/app/FreshRSS.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-31 14:52:01 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-31 14:52:01 +0100
commit5c9a32329ad68dc5ae8bc8a3566a0d603b80a934 (patch)
treedea1d08894aeef6e3795ed8d2e9809d42560b9d7 /app/FreshRSS.php
parent1ac09e7fe4a5408290d06116c6fb8152e018fe26 (diff)
Multi-utilisateur fonctionnel avec Mozilla Persona
Il faut ré-enregistrer l'adresse courriel une fois dans l'interface de FreshRSS pour créer le fichier nécessaire. + Comparaison sans tenir compte de la casse pour les noms d'utilisateur. Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126 ll faudra tester la sécurité
Diffstat (limited to 'app/FreshRSS.php')
-rw-r--r--app/FreshRSS.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/app/FreshRSS.php b/app/FreshRSS.php
index 0e166cc3b..0af0c01da 100644
--- a/app/FreshRSS.php
+++ b/app/FreshRSS.php
@@ -18,8 +18,18 @@ class FreshRSS extends Minz_FrontController {
$loginOk = $currentUser != '';
break;
case 'persona':
- $currentUser = Minz_Configuration::defaultUser(); //TODO: Make Persona compatible with multi-user
- $loginOk = Minz_Session::param('mail') != '';
+ $loginOk = false;
+ $email = filter_var(Minz_Session::param('mail'), FILTER_VALIDATE_EMAIL);
+ if ($email != '') { //TODO: Remove redundancy with indexController
+ $personaFile = DATA_PATH . '/persona/' . $email . '.txt';
+ if (($currentUser = @file_get_contents($personaFile)) !== false) {
+ $currentUser = trim($currentUser);
+ $loginOk = true;
+ }
+ }
+ if (!$loginOk) {
+ $currentUser = Minz_Configuration::defaultUser();
+ }
break;
case 'none':
$currentUser = Minz_Configuration::defaultUser();
@@ -51,10 +61,10 @@ class FreshRSS extends Minz_FrontController {
if ($loginOk) {
switch (Minz_Configuration::authType()) {
case 'http_auth':
- $loginOk = $currentUser === httpAuthUser();
+ $loginOk = strcasecmp($currentUser, httpAuthUser()) === 0;
break;
case 'persona':
- $loginOk = Minz_Session::param('mail') === $this->conf->mail_login;
+ $loginOk = strcasecmp(Minz_Session::param('mail'), $this->conf->mail_login) === 0;
break;
case 'none':
$loginOk = true;