Remove Google auth (openid is deprecated) and Persona auth (useless)

This commit is contained in:
Frédéric Guillot 2014-11-07 20:53:50 -05:00
parent e26a1873ef
commit f4efaadad1
19 changed files with 19 additions and 366 deletions

View File

@ -11,7 +11,6 @@ Features
- Your Raspberry Pi, a shared web-hosting, a virtual machine or localhost
- Easy setup => copy and paste the source code and you are done!
- Use a lightweight Sqlite database instead of Mysql or Postgresql
- Auto-update from the user interface
### Readability
@ -30,11 +29,6 @@ Features
- Translated in English, French, German, Italian, Czech, Spanish, Portuguese and Simplified Chinese
- RTL languages support
### Users management
- Alternate authentication with a Google Account or Mozilla Persona
- Multiple databases (each user has his own database)
### Awesome features
- Keyboard shortcuts
@ -48,6 +42,8 @@ Features
- Basic bookmarks
- Import/Export of OPML feeds
- Themes
- Auto-update from the user interface
- Multiple databases (each user has his own database)
Requirements
------------

21
assets/js/all.min.js vendored
View File

@ -1,24 +1,21 @@
var Miniflux={};
Miniflux.App=function(){return{BlinkIcon:function(){var d=document.querySelectorAll(".loading-icon");[].forEach.call(d,function(b){b.classList.toggle("loading-icon-blink")})},Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()},MozillaAuth:function(d){navigator.id.watch({onlogin:function(b){var a=new XMLHttpRequest;a.open("POST","?action="+d+"&token="+b,!0);a.setRequestHeader("Connection","close");a.onload=function(){window.location.href=this.responseText};a.send("token="+
b)},onlogout:function(){}});navigator.id.request()}}}();
var Miniflux={};Miniflux.App=function(){return{BlinkIcon:function(){var d=document.querySelectorAll(".loading-icon");[].forEach.call(d,function(b){b.classList.toggle("loading-icon-blink")})},Run:function(){Miniflux.Event.ListenKeyboardEvents();Miniflux.Event.ListenMouseEvents()}}}();
Miniflux.Feed=function(){function d(a){if(a=document.getElementById("loading-feed-"+a))a.appendChild(document.createTextNode("\u2600")),a.classList.add("loading-icon-blink");f||(f=setInterval(Miniflux.App.BlinkIcon,500))}function b(){for(var b=document.getElementsByTagName("a"),c=0,d=b.length;c<d;c++){var e=b[c].getAttribute("data-feed-id");e&&a.push(parseInt(e))}}var a=[],c=[],f;return{Update:function(a,b){d(a);var c=new XMLHttpRequest;c.onload=function(){var e=document.getElementById("loading-feed-"+
a);e&&(e.innerHTML="");if(e=document.getElementById("last-checked-feed-"+a))e.innerHTML=e.getAttribute("data-after-update");try{var k=JSON.parse(this.responseText);if(k.result){var p=k.items_count,c=document.getElementById("items-count-"+a);c&&(c.innerHTML="("+p.items_unread+"/"+p.items_total+")")}b&&b(k)}catch(d){}};c.open("POST","?action=refresh-feed&feed_id="+a,!0);c.send()},UpdateAll:function(){b();var d=setInterval(function(){for(;0<a.length&&5>c.length;){var b=a.shift();c.push(b);Miniflux.Feed.Update(b,
a);e&&(e.innerHTML="");if(e=document.getElementById("last-checked-feed-"+a))e.innerHTML=e.getAttribute("data-after-update");try{var h=JSON.parse(this.responseText);if(h.result){var n=h.items_count,c=document.getElementById("items-count-"+a);c&&(c.innerHTML="("+n.items_unread+"/"+n.items_total+")")}b&&b(h)}catch(d){}};c.open("POST","?action=refresh-feed&feed_id="+a,!0);c.send()},UpdateAll:function(){b();var d=setInterval(function(){for(;0<a.length&&5>c.length;){var b=a.shift();c.push(b);Miniflux.Feed.Update(b,
function(b){b=c.indexOf(b.feed_id);0<=b&&c.splice(b,1);0==a.length&&0==c.length&&(clearInterval(d),clearInterval(f),window.location.href="?action=unread")})}},100)}}}();
Miniflux.Item=function(){function d(e){var a=document.getElementById("item-"+e);a||(a=document.getElementById("current-item"),a.getAttribute("data-item-id")!=e&&(a=!1));return a}function b(e){if(e&&e.getAttribute("data-reverse-label")){var a=e.innerHTML;e.innerHTML=e.getAttribute("data-reverse-label");e.setAttribute("data-reverse-label",a)}}function a(e){e=document.getElementById("bookmark-"+e);b(e)}function c(e){e=document.getElementById("status-"+e);b(e)}function f(e){"mouse"!=Miniflux.Event.lastEventType&&
Miniflux.Nav.SelectNextItem();e.parentNode.removeChild(e);var a=document.getElementById("page-counter");if(a){e=e.getAttribute("data-item-page");var b=parseInt(a.textContent,10)-1,c=document.getElementsByTagName("article");if(0===b||0===c.length)window.location=location.href;a.textContent=b;switch(e){case "unread":document.title="Miniflux ("+b+")";document.getElementById("nav-counter").textContent="("+b+")";break;case "feed-items":document.title="("+b+") "+a.parentNode.firstChild.nodeValue;break;
default:document.title=a.parentNode.textContent}}}function g(e){var a=new XMLHttpRequest;a.onload=function(){if(Miniflux.Nav.IsListing()){var a=d(e);if(a)if(a.getAttribute("data-hide"))f(a);else{a.setAttribute("data-item-status","read");c(e);if(a=document.getElementById("show-"+e)){a.className="read";var b=document.createElement("span");b.id="read-icon-"+e;b.appendChild(document.createTextNode("\u2714 "));a.parentNode.insertBefore(b,a)}(a=document.getElementById("status-"+e))&&a.setAttribute("data-action",
"mark-unread")}}};a.open("POST","?action=mark-item-read&id="+e,!0);a.send()}function m(a){var b=new XMLHttpRequest;b.onload=function(){if(Miniflux.Nav.IsListing()){var b=d(a);if(b)if(b.getAttribute("data-hide"))f(b);else{b.setAttribute("data-item-status","unread");c(a);if(b=document.getElementById("show-"+a))b.className="";(b=document.getElementById("read-icon-"+a))&&b.parentNode.removeChild(b);(b=document.getElementById("status-"+a))&&b.setAttribute("data-action","mark-read")}}};b.open("POST","?action=mark-item-unread&id="+
a,!0);b.send()}function n(b,c){var d=b.getAttribute("data-item-id"),h=new XMLHttpRequest;h.onload=function(){try{if(JSON.parse(this.responseText).result)if(b.setAttribute("data-item-bookmark",c),c)if(Miniflux.Nav.IsListing()){if(f=document.getElementById("show-"+d)){var h=document.createElement("span");h.id="bookmark-icon-"+d;h.appendChild(document.createTextNode("\u2605 "));f.parentNode.insertBefore(h,f)}a(d)}else{var f=document.getElementById("bookmark-"+d);f&&(f.innerHTML="\u2605")}else if(Miniflux.Nav.IsListing()){var l=
document.getElementById("bookmark-icon-"+d);l&&l.parentNode.removeChild(l);a(d)}else{var q=document.getElementById("bookmark-"+d);q&&(q.innerHTML="\u2606")}}catch(g){}};h.open("POST","?action=bookmark&id="+d+"&value="+c,!0);h.send()}return{Get:d,MarkAsRead:g,MarkAsUnread:m,MarkAsRemoved:function(a){var b=new XMLHttpRequest;b.onload=function(){Miniflux.Nav.IsListing()&&f(d(a))};b.open("POST","?action=mark-item-removed&id="+a,!0);b.send()},SwitchBookmark:function(a){"1"==a.getAttribute("data-item-bookmark")?
n(a,0):n(a,1)},SwitchStatus:function(a){var b=a.getAttribute("data-item-id");a=a.getAttribute("data-item-status");"read"==a?m(b):"unread"==a&&g(b)},Show:function(a){(a=document.getElementById("show-"+a))&&a.click()},OpenOriginal:function(a){var b=document.getElementById("original-"+a);b&&("unread"==d(a).getAttribute("data-item-status")&&g(a),b.removeAttribute("data-action"),b.click())},DownloadContent:function(){var a=document.getElementById("download-item");if(a){var b=a.getAttribute("data-item-id"),
"mark-unread")}}};a.open("POST","?action=mark-item-read&id="+e,!0);a.send()}function l(a){var b=new XMLHttpRequest;b.onload=function(){if(Miniflux.Nav.IsListing()){var b=d(a);if(b)if(b.getAttribute("data-hide"))f(b);else{b.setAttribute("data-item-status","unread");c(a);if(b=document.getElementById("show-"+a))b.className="";(b=document.getElementById("read-icon-"+a))&&b.parentNode.removeChild(b);(b=document.getElementById("status-"+a))&&b.setAttribute("data-action","mark-read")}}};b.open("POST","?action=mark-item-unread&id="+
a,!0);b.send()}function m(e,b){var c=e.getAttribute("data-item-id"),d=new XMLHttpRequest;d.onload=function(){try{if(JSON.parse(this.responseText).result)if(e.setAttribute("data-item-bookmark",b),b)if(Miniflux.Nav.IsListing()){if(f=document.getElementById("show-"+c)){var d=document.createElement("span");d.id="bookmark-icon-"+c;d.appendChild(document.createTextNode("\u2605 "));f.parentNode.insertBefore(d,f)}a(c)}else{var f=document.getElementById("bookmark-"+c);f&&(f.innerHTML="\u2605")}else if(Miniflux.Nav.IsListing()){var k=
document.getElementById("bookmark-icon-"+c);k&&k.parentNode.removeChild(k);a(c)}else{var p=document.getElementById("bookmark-"+c);p&&(p.innerHTML="\u2606")}}catch(g){}};d.open("POST","?action=bookmark&id="+c+"&value="+b,!0);d.send()}return{Get:d,MarkAsRead:g,MarkAsUnread:l,MarkAsRemoved:function(a){var b=new XMLHttpRequest;b.onload=function(){Miniflux.Nav.IsListing()&&f(d(a))};b.open("POST","?action=mark-item-removed&id="+a,!0);b.send()},SwitchBookmark:function(a){"1"==a.getAttribute("data-item-bookmark")?
m(a,0):m(a,1)},SwitchStatus:function(a){var b=a.getAttribute("data-item-id");a=a.getAttribute("data-item-status");"read"==a?l(b):"unread"==a&&g(b)},Show:function(a){(a=document.getElementById("show-"+a))&&a.click()},OpenOriginal:function(a){var b=document.getElementById("original-"+a);b&&("unread"==d(a).getAttribute("data-item-status")&&g(a),b.removeAttribute("data-action"),b.click())},DownloadContent:function(){var a=document.getElementById("download-item");if(a){var b=a.getAttribute("data-item-id"),
c=a.getAttribute("data-before-message"),d=document.createElement("span");d.appendChild(document.createTextNode("\u2600"));d.className="loading-icon";a.innerHTML="";a.className="downloading";a.appendChild(d);a.appendChild(document.createTextNode(" "+c));var f=setInterval(Miniflux.App.BlinkIcon,250),g=new XMLHttpRequest;g.onload=function(){var b=JSON.parse(g.responseText);clearInterval(f);if(b.result){var c=document.getElementById("item-content");c&&(c.innerHTML=b.content);a&&(b=a.getAttribute("data-after-message"),
a.innerHTML="",a.appendChild(document.createTextNode(" "+b)))}else a&&(b=a.getAttribute("data-failure-message"),a.innerHTML="",a.appendChild(document.createTextNode(" "+b)))};g.open("POST","?action=download-item&id="+b,!0);g.send()}},MarkListingAsRead:function(a){for(var b=document.getElementsByTagName("article"),c=[],d=0,f=b.length;d<f;d++)c.push(b[d].getAttribute("data-item-id"));b=new XMLHttpRequest;b.onload=function(){window.location.href=a};b.open("POST","?action=mark-items-as-read",!0);b.send(JSON.stringify(c))}}}();
Miniflux.Event=function(){var d=[];return{lastEventType:"",ListenMouseEvents:function(){document.onclick=function(b){var a=b.target.getAttribute("data-action");if(a)switch(Miniflux.Event.lastEventType="mouse",a){case "refresh-all":b.preventDefault();Miniflux.Feed.UpdateAll();break;case "refresh-feed":b.preventDefault();Miniflux.Feed.Update(b.target.getAttribute("data-feed-id"));break;case "mark-read":b.preventDefault();Miniflux.Item.MarkAsRead(b.target.getAttribute("data-item-id"));break;case "mark-unread":b.preventDefault();
Miniflux.Item.MarkAsUnread(b.target.getAttribute("data-item-id"));break;case "mark-removed":b.preventDefault();Miniflux.Item.MarkAsRemoved(b.target.getAttribute("data-item-id"));break;case "bookmark":b.preventDefault();Miniflux.Item.SwitchBookmark(Miniflux.Item.Get(b.target.getAttribute("data-item-id")));break;case "download-item":b.preventDefault();Miniflux.Item.DownloadContent();break;case "original-link":b.preventDefault();Miniflux.Item.OpenOriginal(b.target.getAttribute("data-item-id"));break;
case "mark-all-read":b.preventDefault();Miniflux.Item.MarkListingAsRead("?action=unread");break;case "mark-feed-read":b.preventDefault();Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+b.target.getAttribute("data-feed-id"));break;case "mozilla-login":b.preventDefault();Miniflux.App.MozillaAuth("mozilla-auth");break;case "mozilla-link":b.preventDefault(),Miniflux.App.MozillaAuth("mozilla-link")}}},ListenKeyboardEvents:function(){document.onkeypress=function(b){if(!(b.ctrlKey||b.shiftKey||
b.altKey||b.metaKey)){var a=b.target||b.srcElement;if("INPUT"!=a.tagName&&"TEXTAREA"!=a.tagName)if(Miniflux.Event.lastEventType="keyboard",d.push(b.keyCode||b.which),103==d[0])switch(d[1]){case void 0:break;case 117:window.location.href="?action=unread";d=[];break;case 98:window.location.href="?action=bookmarks";d=[];break;case 104:window.location.href="?action=history";d=[];break;case 115:window.location.href="?action=feeds";d=[];break;case 112:window.location.href="?action=config";d=[];break;default:d=
[]}else switch(d=[],b.keyCode||b.which){case 100:Miniflux.Item.DownloadContent(Miniflux.Nav.GetCurrentItemId());break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();break;case 110:case 106:Miniflux.Nav.SelectNextItem();break;case 118:Miniflux.Item.OpenOriginal(Miniflux.Nav.GetCurrentItemId());break;case 111:Miniflux.Item.Show(Miniflux.Nav.GetCurrentItemId());break;case 109:Miniflux.Item.SwitchStatus(Miniflux.Nav.GetCurrentItem());break;case 102:Miniflux.Item.SwitchBookmark(Miniflux.Nav.GetCurrentItem());
break;case 104:Miniflux.Nav.OpenPreviousPage();break;case 108:Miniflux.Nav.OpenNextPage();break;case 114:Miniflux.Feed.UpdateAll();break;case 63:Miniflux.Nav.ShowHelp()}}}}}}();
case "mark-all-read":b.preventDefault();Miniflux.Item.MarkListingAsRead("?action=unread");break;case "mark-feed-read":b.preventDefault(),Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id="+b.target.getAttribute("data-feed-id"))}}},ListenKeyboardEvents:function(){document.onkeypress=function(b){if(!(b.ctrlKey||b.shiftKey||b.altKey||b.metaKey)){var a=b.target||b.srcElement;if("INPUT"!=a.tagName&&"TEXTAREA"!=a.tagName)if(Miniflux.Event.lastEventType="keyboard",d.push(b.keyCode||b.which),103==
d[0])switch(d[1]){case void 0:break;case 117:window.location.href="?action=unread";d=[];break;case 98:window.location.href="?action=bookmarks";d=[];break;case 104:window.location.href="?action=history";d=[];break;case 115:window.location.href="?action=feeds";d=[];break;case 112:window.location.href="?action=config";d=[];break;default:d=[]}else switch(d=[],b.keyCode||b.which){case 100:Miniflux.Item.DownloadContent(Miniflux.Nav.GetCurrentItemId());break;case 112:case 107:Miniflux.Nav.SelectPreviousItem();
break;case 110:case 106:Miniflux.Nav.SelectNextItem();break;case 118:Miniflux.Item.OpenOriginal(Miniflux.Nav.GetCurrentItemId());break;case 111:Miniflux.Item.Show(Miniflux.Nav.GetCurrentItemId());break;case 109:Miniflux.Item.SwitchStatus(Miniflux.Nav.GetCurrentItem());break;case 102:Miniflux.Item.SwitchBookmark(Miniflux.Nav.GetCurrentItem());break;case 104:Miniflux.Nav.OpenPreviousPage();break;case 108:Miniflux.Nav.OpenNextPage();break;case 114:Miniflux.Feed.UpdateAll();break;case 63:Miniflux.Nav.ShowHelp()}}}}}}();
Miniflux.Nav=function(){function d(a){var b=pageYOffset+document.documentElement.clientHeight;(0>b-(a.offsetTop+a.offsetHeight)||b-a.offsetTop>document.documentElement.clientHeight)&&window.scrollTo(0,a.offsetTop-10)}function b(){return document.getElementById("listing")?!0:!1}return{GetCurrentItem:function(){return document.getElementById("current-item")},GetCurrentItemId:function(){var a=Miniflux.Nav.GetCurrentItem();return a?a.getAttribute("data-item-id"):null},OpenNextPage:function(){var a=document.getElementById("next-page");
a&&a.click()},OpenPreviousPage:function(){var a=document.getElementById("previous-page");a&&a.click()},SelectNextItem:function(){var a=document.getElementById("next-item");if(a)a.click();else if(b())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=0,f=a.length;c<f;c++){if("current-item"==a[c].id){a[c].id="item-"+a[c].getAttribute("data-item-id");c+1<f&&(a[c+1].id="current-item",d(a[c+1]));break}}else a[0].id="current-item",d(a[0])},SelectPreviousItem:function(){var a=
document.getElementById("previous-item");if(a)a.click();else if(b())if(a=document.getElementsByTagName("article"),document.getElementById("current-item"))for(var c=a.length-1;0<=c;c--){if("current-item"==a[c].id){a[c].id="item-"+a[c].getAttribute("data-item-id");0<=c-1&&(a[c-1].id="current-item",d(a[c-1]));break}}else a[a.length-1].id="current-item",d(a[a.length-1])},ShowHelp:function(){open("?action=show-help","Help","width=320,height=450,location=no,scrollbars=no,status=no,toolbar=no")},IsListing:b}}();

View File

@ -14,25 +14,6 @@ Miniflux.App = (function() {
Run: function() {
Miniflux.Event.ListenKeyboardEvents();
Miniflux.Event.ListenMouseEvents();
},
MozillaAuth: function(action) {
navigator.id.watch({
onlogin: function(assertion) {
var xhr = new XMLHttpRequest();
xhr.open("POST", "?action=" + action + "&token=" + assertion, true);
xhr.setRequestHeader("Connection", "close");
xhr.onload = function () {
window.location.href = this.responseText;
};
xhr.send("token=" + assertion);
},
onlogout: function() {}
});
navigator.id.request();
}
}

View File

@ -55,14 +55,6 @@ Miniflux.Event = (function() {
e.preventDefault();
Miniflux.Item.MarkListingAsRead("?action=feed-items&feed_id=" + e.target.getAttribute("data-feed-id"));
break;
case 'mozilla-login':
e.preventDefault();
Miniflux.App.MozillaAuth("mozilla-auth");
break;
case 'mozilla-link':
e.preventDefault();
Miniflux.App.MozillaAuth("mozilla-link");
break;
}
}
};

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ Router\before(function($action) {
}
// Redirect to the login form if the user is not authenticated
$ignore_actions = array('login', 'google-auth', 'google-redirect-auth', 'mozilla-auth', 'bookmark-feed', 'select-db');
$ignore_actions = array('login', 'bookmark-feed', 'select-db');
if (! isset($_SESSION['user']) && ! in_array($action, $ignore_actions)) {
@ -37,13 +37,10 @@ Router\before(function($action) {
date_default_timezone_set(Model\Config\get('timezone') ?: 'UTC');
// HTTP secure headers
$frame_src = Model\Config\get_iframe_whitelist();;
$frame_src[] = 'https://login.persona.org';
Response\csp(array(
'media-src' => '*',
'img-src' => '*',
'frame-src' => $frame_src
'frame-src' => Model\Config\get_iframe_whitelist(),
));
Response\xframe();

View File

@ -1,7 +1,5 @@
<?php
require_once __DIR__.'/../lib/AuthProvider.php';
use PicoFarad\Router;
use PicoFarad\Response;
use PicoFarad\Request;
@ -24,8 +22,6 @@ Router\get_action('login', function() {
}
Response\html(Template\load('login', array(
'google_auth_enable' => Model\Config\get('auth_google_token') !== '',
'mozilla_auth_enable' => Model\Config\get('auth_mozilla_token') !== '',
'errors' => array(),
'values' => array(),
'databases' => Model\Database\get_list(),
@ -44,105 +40,9 @@ Router\post_action('login', function() {
}
Response\html(Template\load('login', array(
'google_auth_enable' => Model\Config\get('auth_google_token') !== '',
'mozilla_auth_enable' => Model\Config\get('auth_mozilla_token') !== '',
'errors' => $errors,
'values' => $values,
'databases' => Model\Database\get_list(),
'current_database' => Model\Database\select()
)));
});
// Link to a Google Account (redirect)
Router\get_action('google-redirect-link', function() {
Response\Redirect(AuthProvider\google_get_url(Helper\get_current_base_url(), '?action=google-link'));
});
// Link to a Google Account (association)
Router\get_action('google-link', function() {
list($valid, $token) = AuthProvider\google_validate();
if ($valid) {
Model\Config\save_auth_token('google', $token);
Session\flash(t('Your Google Account is linked to Miniflux.'));
}
else {
Session\flash_error(t('Unable to link Miniflux to your Google Account.'));
}
Response\redirect('?action=config');
});
// Authenticate with a Google Account (redirect)
Router\get_action('google-redirect-auth', function() {
Response\Redirect(AuthProvider\google_get_url(Helper\get_current_base_url(), '?action=google-auth'));
});
// Authenticate with a Google Account (callback url)
Router\get_action('google-auth', function() {
list($valid, $token) = AuthProvider\google_validate();
if ($valid && $token === Model\Config\get('auth_google_token')) {
$_SESSION['user'] = array(
'username' => Model\Config\get('username'),
'language' => Model\Config\get('language'),
);
Response\redirect('?action=unread');
}
else {
Response\html(Template\load('login', array(
'google_auth_enable' => Model\Config\get('auth_google_token') !== '',
'mozilla_auth_enable' => Model\Config\get('auth_mozilla_token') !== '',
'errors' => array('login' => t('Unable to authenticate with Google')),
'values' => array()
)));
}
});
// Authenticate with a Mozilla Persona (ajax check)
Router\post_action('mozilla-auth', function() {
list($valid, $token) = AuthProvider\mozilla_validate(Request\param('token'));
if ($valid && $token === Model\Config\get('auth_mozilla_token')) {
$_SESSION['user'] = array(
'username' => Model\Config\get('username'),
'language' => Model\Config\get('language'),
);
Response\text('?action=unread');
}
else {
Response\text("?action=login");
}
});
// Link Miniflux to a Mozilla Account (ajax check)
Router\post_action('mozilla-link', function() {
list($valid, $token) = AuthProvider\mozilla_validate(Request\param('token'));
if ($valid) {
Model\Config\save_auth_token('mozilla', $token);
Session\flash(t('Your Mozilla Persona Account is linked to Miniflux.'));
}
else {
Session\flash_error(t('Unable to link Miniflux to your Mozilla Persona Account.'));
}
Response\text("?action=config");
});
// Remove account link
Router\get_action('unlink-account-provider', function() {
Model\Config\remove_auth_token(Request\param('type'));
Response\redirect('?action=config');
});

View File

@ -1,94 +0,0 @@
<?php
namespace AuthProvider;
function google_get_url($realm, $return_path)
{
$return_to = $realm.$return_path;
$url = 'https://accounts.google.com/o/openid2/auth?';
$params = array();
$params['openid.ns'] = 'http://specs.openid.net/auth/2.0';
$params['openid.mode'] = 'checkid_setup';
$params['openid.return_to'] = $return_to;
$params['openid.realm'] = $realm;
$params['openid.identity'] = 'http://specs.openid.net/auth/2.0/identifier_select';
$params['openid.claimed_id'] = 'http://specs.openid.net/auth/2.0/identifier_select';
return $url.http_build_query($params, '', '&');
}
function google_validate()
{
$identity = '';
if (! ini_get('allow_url_fopen')) {
die('You must have "allow_url_fopen=On" to use this feature!');
}
if (! isset($_GET['openid_mode']) || $_GET['openid_mode'] !== 'id_res') {
return array(false, $identity);
}
$params = array();
$params['openid.ns'] = 'http://specs.openid.net/auth/2.0';
$params['openid.mode'] = 'check_authentication';
$params['openid.assoc_handle'] = $_GET['openid_assoc_handle'];
$params['openid.signed'] = $_GET['openid_signed'];
$params['openid.sig'] = $_GET['openid_sig'];
foreach (explode(',', $_GET['openid_signed']) as $item) {
$params['openid.'.$item] = $_GET['openid_' . str_replace('.', '_', $item)];
}
$context = stream_context_create(array(
'http'=>array(
'method'=> 'POST',
'header'=> implode("\r\n", array(
'Content-type: application/x-www-form-urlencoded',
'Accept: application/xrds+xml, */*'
)),
'content' => http_build_query($params, '', '&')
)));
$response = file_get_contents('https://www.google.com/accounts/o8/ud', false, $context);
$identity = $_GET['openid_identity'];
return array(strpos($response, 'is_valid:true') !== false, $identity);
}
function mozilla_validate($token)
{
if (! ini_get('allow_url_fopen')) {
die('You must have "allow_url_fopen=On" to use this feature!');
}
$params = array(
'assertion' => $token,
'audience' => (isset($_SERVER['HTTPS']) ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT']
);
$context = stream_context_create(array(
'http'=> array(
'method'=> 'POST',
'header'=> implode("\r\n", array(
'Content-type: application/x-www-form-urlencoded',
)),
'content' => http_build_query($params, '', '&')
)));
$body = @file_get_contents('https://verifier.login.persona.org/verify', false, $context);
$response = json_decode($body, true);
if (! $response) {
return array(
false,
''
);
}
return array(
$response['status'] === 'okay',
$response['email']
);
}

View File

@ -37,17 +37,6 @@ return array(
// 'Go to history' => '',
// 'Go to subscriptions' => '',
// 'Go to preferences' => '',
// 'Your Google Account is linked to Miniflux' => '',
// 'Link Miniflux to my Google account' => '',
// 'Link Miniflux to my Mozilla Persona account' => '',
// 'Your Google Account is linked to Miniflux.' => '',
// 'Unable to link Miniflux to your Google Account.' => '',
// 'Unable to authenticate with Google' => '',
// 'Your Mozilla Persona Account is linked to Miniflux' => '',
// 'Your Mozilla Persona Account is linked to Miniflux.' => '',
// 'Unable to link Miniflux to your Mozilla Persona Account.' => '',
// 'Login with my Google Account' => '',
// 'Login with my Mozilla Persona Account' => '',
// 'Bookmarklet:' => '',
// 'Subscribe with Miniflux' => '',
// 'Drag and drop this link to your bookmarks' => '',

View File

@ -37,17 +37,6 @@ return array(
'Go to history' => 'Zu dem Verlauf gehen',
'Go to subscriptions' => 'Zu den Abonnements gehen',
'Go to preferences' => 'Zu den Einstellungen gehen',
'Your Google Account is linked to Miniflux' => 'Dein Google-Account ist mit Miniflux verbunden',
'Link Miniflux to my Google account' => 'Miniflux mit Google-Account verbinden',
'Link Miniflux to my Mozilla Persona account' => 'Miniflux mit Mozilla Persona verbinden',
'Your Google Account is linked to Miniflux.' => 'Dein Google-Account ist mit Miniflux verbunden.',
'Unable to link Miniflux to your Google Account.' => 'Verbindung von Miniflux mit dem Google-Account fehlgeschlagen.',
'Unable to authenticate with Google' => 'Authentifizierung mit Google-Account fehlgeschlagen',
'Your Mozilla Persona Account is linked to Miniflux' => 'Dein "Mozilla Persona"-Account ist mit Miniflux verbunden',
'Your Mozilla Persona Account is linked to Miniflux.' => 'Dein "Mozilla Persona"-Account ist mit Miniflux verbunden.',
'Unable to link Miniflux to your Mozilla Persona Account.' => 'Verbindung von Miniflux mit dem "Mozilla Persona"-Account fehlgeschlagen.',
'Login with my Google Account' => 'Mit Google-Account anmelden',
'Login with my Mozilla Persona Account' => 'Mit Mozilla Persona anmelden',
'Bookmarklet:' => 'Bookmarklet:',
'Subscribe with Miniflux' => 'Mit Miniflux abonnieren',
'Drag and drop this link to your bookmarks' => 'Ziehe diesen Link in deine Lesezeichen',

View File

@ -37,17 +37,6 @@ return array(
'Go to history' => 'Ir al historial',
'Go to subscriptions' => 'Ir a suscripciones',
'Go to preferences' => 'Ir a preferencias',
'Your Google Account is linked to Miniflux' => 'Su cuenta de Google está vinculada con Miniflux',
'Link Miniflux to my Google account' => 'Vincular Miniflux con mi cuenta de Google',
'Link Miniflux to my Mozilla Persona account' => 'Vincular Miniflux con mi cuenta de Mozilla Persona',
'Your Google Account is linked to Miniflux.' => 'Su cuenta de Google está vinculada con Miniflux.',
'Unable to link Miniflux to your Google Account.' => 'No se puede vincular Miniflux con su cuenta de Google.',
'Unable to authenticate with Google' => 'No se puede autenticar con Google',
// 'Your Mozilla Persona Account is linked to Miniflux' => '',
'Your Mozilla Persona Account is linked to Miniflux.' => 'Su cuenta de Mozilla Persona está vinculada con Miniflux.',
'Unable to link Miniflux to your Mozilla Persona Account.' => 'No se puede vincular Miniflux con su cuenta de Mozilla Persona.',
'Login with my Google Account' => 'Iniciar sesión con mi cuenta de Google',
'Login with my Mozilla Persona Account' => 'Iniciar sesión con mi cuenta de Mozilla Persona',
'Bookmarklet:' => 'Bookmarklet:',
'Subscribe with Miniflux' => 'Suscribir con Miniflux',
'Drag and drop this link to your bookmarks' => 'Arrastrar y soltar el enlace en los marcadores',

View File

@ -37,17 +37,6 @@ return array(
'Go to history' => 'Voir l\'historique',
'Go to subscriptions' => 'Voir les abonnements',
'Go to preferences' => 'Voir les préférences',
'Your Google Account is linked to Miniflux' => 'Votre compte Google est relié à Miniflux',
'Link Miniflux to my Google account' => 'Lier Miniflux à mon compte Google',
'Link Miniflux to my Mozilla Persona account' => 'Lier Miniflux à mon compte Mozilla Persona',
'Your Google Account is linked to Miniflux.' => 'Votre compte Google est relié à Miniflux.',
'Unable to link Miniflux to your Google Account.' => 'Impossible de lier Miniflux à votre compte Google',
'Unable to authenticate with Google' => 'Impossible de s\'authentifier avec Google',
'Your Mozilla Persona Account is linked to Miniflux' => 'Votre compte Mozilla Persona est lié avec Miniflux',
'Your Mozilla Persona Account is linked to Miniflux.' => 'Votre compte Mozilla Persona est lié avec Miniflux.',
'Unable to link Miniflux to your Mozilla Persona Account.' => 'Impossible de lier Miniflux avec votre compte Mozilla Persona.',
'Login with my Google Account' => 'Se connecter avec mon compte Google',
'Login with my Mozilla Persona Account' => 'Se connecter avec mon compte Mozilla Persona',
'Bookmarklet:' => 'Bookmarklet :',
'Subscribe with Miniflux' => 'S\'abonner avec Miniflux',
'Drag and drop this link to your bookmarks' => 'Glisser-déposer ce lien dans vos favoris',

View File

@ -37,17 +37,6 @@ return array(
// 'Go to history' => '',
// 'Go to subscriptions' => '',
// 'Go to preferences' => '',
// 'Your Google Account is linked to Miniflux' => '',
// 'Link Miniflux to my Google account' => '',
// 'Link Miniflux to my Mozilla Persona account' => '',
// 'Your Google Account is linked to Miniflux.' => '',
// 'Unable to link Miniflux to your Google Account.' => '',
// 'Unable to authenticate with Google' => '',
// 'Your Mozilla Persona Account is linked to Miniflux' => '',
// 'Your Mozilla Persona Account is linked to Miniflux.' => '',
// 'Unable to link Miniflux to your Mozilla Persona Account.' => '',
// 'Login with my Google Account' => '',
// 'Login with my Mozilla Persona Account' => '',
// 'Bookmarklet:' => '',
// 'Subscribe with Miniflux' => '',
// 'Drag and drop this link to your bookmarks' => '',

View File

@ -37,17 +37,6 @@ return array(
// 'Go to history' => '',
// 'Go to subscriptions' => '',
// 'Go to preferences' => '',
// 'Your Google Account is linked to Miniflux' => '',
// 'Link Miniflux to my Google account' => '',
// 'Link Miniflux to my Mozilla Persona account' => '',
// 'Your Google Account is linked to Miniflux.' => '',
// 'Unable to link Miniflux to your Google Account.' => '',
// 'Unable to authenticate with Google' => '',
// 'Your Mozilla Persona Account is linked to Miniflux' => '',
// 'Your Mozilla Persona Account is linked to Miniflux.' => '',
// 'Unable to link Miniflux to your Mozilla Persona Account.' => '',
// 'Login with my Google Account' => '',
// 'Login with my Mozilla Persona Account' => '',
// 'Bookmarklet:' => '',
// 'Subscribe with Miniflux' => '',
// 'Drag and drop this link to your bookmarks' => '',

View File

@ -37,17 +37,6 @@ return array(
// 'Go to history' => '',
// 'Go to subscriptions' => '',
// 'Go to preferences' => '',
// 'Your Google Account is linked to Miniflux' => '',
// 'Link Miniflux to my Google account' => '',
// 'Link Miniflux to my Mozilla Persona account' => '',
// 'Your Google Account is linked to Miniflux.' => '',
// 'Unable to link Miniflux to your Google Account.' => '',
// 'Unable to authenticate with Google' => '',
// 'Your Mozilla Persona Account is linked to Miniflux' => '',
// 'Your Mozilla Persona Account is linked to Miniflux.' => '',
// 'Unable to link Miniflux to your Mozilla Persona Account.' => '',
// 'Login with my Google Account' => '',
// 'Login with my Mozilla Persona Account' => '',
// 'Bookmarklet:' => '',
// 'Subscribe with Miniflux' => '',
// 'Drag and drop this link to your bookmarks' => '',

View File

@ -241,8 +241,6 @@ function get_all()
'feed_token',
'fever_token',
'bookmarklet_token',
'auth_google_token',
'auth_mozilla_token',
'items_sorting_direction',
'items_display_mode',
'redirect_nothing_to_read',

View File

@ -49,23 +49,6 @@
<?= Helper\form_text('auto_update_url', $values, $errors, array('required')) ?><br/>
<?php endif ?>
<ul>
<li>
<?php if ($values['auth_google_token']): ?>
<?= t('Your Google Account is linked to Miniflux') ?>, <a href="?action=unlink-account-provider&amp;type=google"><?= t('remove') ?></a>
<?php else: ?>
<a href="?action=google-redirect-link"><?= t('Link Miniflux to my Google account') ?></a>
<?php endif ?>
</li>
<li>
<?php if ($values['auth_mozilla_token']): ?>
<?= t('Your Mozilla Persona Account is linked to Miniflux') ?>, <a href="?action=unlink-account-provider&amp;type=mozilla"><?= t('remove') ?></a>
<?php else: ?>
<a href="#" data-action="mozilla-link"><?= t('Link Miniflux to my Mozilla Persona account') ?></a>
<?php endif ?>
</li>
</ul>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
</div>

View File

@ -4,18 +4,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" type="image/png" href="./assets/img/favicon.png">
<link rel="icon" type="image/png" href="assets/img/favicon.png">
<link rel="shortcut icon" href="favicon.ico">
<link rel="apple-touch-icon" href="./assets/img/touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="72x72" href="./assets/img/touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="114x114" href="./assets/img/touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="144x144" href="./assets/img/touch-icon-ipad-retina.png">
<link rel="apple-touch-icon" href="assets/img/touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/img/touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/img/touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="144x144" href="assets/img/touch-icon-ipad-retina.png">
<title>Miniflux</title>
<link href="<?= Helper\css() ?>" rel="stylesheet" media="screen">
<?php if ($mozilla_auth_enable): ?>
<script type="text/javascript" src="assets/js/all.min.js?<?= filemtime('assets/js/all.min.js') ?>" defer></script>
<script type="text/javascript" src="assets/js/persona.js" defer></script>
<?php endif ?>
</head>
<body id="login-page">
<section class="page">
@ -38,14 +34,6 @@
<?= Helper\form_checkbox('remember_me', t('Remember Me'), 1) ?><br/>
<?php if ($google_auth_enable): ?>
<p><br/><a href="?action=google-redirect-auth"><?= t('Login with my Google Account') ?></a></p>
<?php endif ?>
<?php if ($mozilla_auth_enable): ?>
<p><br/><a href="#" data-action="mozilla-login"><?= t('Login with my Mozilla Persona Account') ?></a></p>
<?php endif ?>
<div class="form-actions">
<input type="submit" value="<?= t('Sign in') ?>" class="btn btn-blue"/>
</div>