summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-07 17:28:56 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-07 17:28:56 +0200
commit99cdd2a0ad7d0c0bf8965ddac2661cfa4c57809d (patch)
treef8cd10a71e2def0c61934e8751012829e4349b1f /app/views
parent530a1d4b6b043f6b6976bb7ad25b380c29d5b5a4 (diff)
parentdbf57266b297c3f831602ec4f451c27a5ad71e6b (diff)
Merge branch 'refactor-authentication' into dev
Diffstat (limited to 'app/views')
-rw-r--r--app/views/auth/formLogin.phtml (renamed from app/views/index/formLogin.phtml)24
-rw-r--r--app/views/auth/logout.phtml0
-rw-r--r--app/views/auth/personaLogin.phtml24
-rw-r--r--app/views/auth/reset.phtml (renamed from app/views/index/resetAuth.phtml)2
-rw-r--r--app/views/configure/archiving.phtml2
-rw-r--r--app/views/helpers/javascript_vars.phtml13
-rw-r--r--app/views/helpers/view/normal_view.phtml6
-rw-r--r--app/views/index/index.phtml2
-rw-r--r--app/views/index/login.phtml1
-rw-r--r--app/views/index/logout.phtml1
-rw-r--r--app/views/users/index.phtml6
11 files changed, 47 insertions, 34 deletions
diff --git a/app/views/index/formLogin.phtml b/app/views/auth/formLogin.phtml
index b05cdced4..0194a11a5 100644
--- a/app/views/index/formLogin.phtml
+++ b/app/views/auth/formLogin.phtml
@@ -1,9 +1,7 @@
<div class="prompt">
- <h1><?php echo _t('login'); ?></h1><?php
+ <h1><?php echo _t('login'); ?></h1>
- switch (Minz_Configuration::authType()) {
- case 'form':
- ?><form id="crypto-form" method="post" action="<?php echo _url('index', 'formLogin'); ?>">
+ <form id="crypto-form" method="post" action="<?php echo _url('auth', 'login'); ?>">
<div>
<label for="username"><?php echo _t('username'); ?></label>
<input type="text" id="username" name="username" size="16" required="required" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" autofocus="autofocus" />
@@ -24,23 +22,7 @@
<div>
<button id="loginButton" type="submit" class="btn btn-important"><?php echo _t('login'); ?></button>
</div>
- </form><?php
- break;
-
- case 'persona':
- ?><p>
- <a class="signin btn btn-important" href="#">
- <?php echo _i('login'); ?>
- <?php echo _t('login_with_persona'); ?>
- </a><br /><br />
-
- <?php echo _i('help'); ?>
- <small>
- <a href="<?php echo _url('index', 'resetAuth'); ?>"><?php echo _t('login_persona_problem'); ?></a>
- </small>
- </p><?php
- break;
- } ?>
+ </form>
<p><a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('about_freshrss'); ?></a></p>
</div>
diff --git a/app/views/auth/logout.phtml b/app/views/auth/logout.phtml
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/app/views/auth/logout.phtml
diff --git a/app/views/auth/personaLogin.phtml b/app/views/auth/personaLogin.phtml
new file mode 100644
index 000000000..dd3e22b52
--- /dev/null
+++ b/app/views/auth/personaLogin.phtml
@@ -0,0 +1,24 @@
+<?php if ($this->res === false) { ?>
+<div class="prompt">
+ <h1><?php echo _t('login'); ?></h1>
+
+ <p>
+ <a class="signin btn btn-important" href="<?php echo _url('auth', 'login'); ?>">
+ <?php echo _i('login'); ?> <?php echo _t('login_with_persona'); ?>
+ </a>
+
+ <br /><br />
+
+ <?php echo _i('help'); ?>
+ <small>
+ <a href="<?php echo _url('auth', 'reset'); ?>"><?php echo _t('login_persona_problem'); ?></a>
+ </small>
+ </p>
+
+ <p><a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('about_freshrss'); ?></a></p>
+</div>
+<?php
+} else {
+ echo json_encode($this->res);
+}
+?>
diff --git a/app/views/index/resetAuth.phtml b/app/views/auth/reset.phtml
index 6d4282c14..e501555c4 100644
--- a/app/views/index/resetAuth.phtml
+++ b/app/views/auth/reset.phtml
@@ -9,7 +9,7 @@
<?php } ?>
<?php if (!$this->no_form) { ?>
- <form id="crypto-form" method="post" action="<?php echo _url('index', 'resetAuth'); ?>">
+ <form id="crypto-form" method="post" action="<?php echo _url('auth', 'reset'); ?>">
<p class="alert alert-warn">
<span class="alert-head"><?php echo _t('attention'); ?></span><br />
<?php echo _t('auth_will_reset'); ?>
diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml
index a883571aa..adbfdb77e 100644
--- a/app/views/configure/archiving.phtml
+++ b/app/views/configure/archiving.phtml
@@ -67,7 +67,7 @@
</div>
</div>
- <?php if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { ?>
+ <?php if (FreshRSS_Auth::hasAccess('admin')) { ?>
<div class="form-group">
<p class="group-name"><?php echo _t('users'); ?></p>
<div class="group-controls">
diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml
index 8f615ed87..3bbcc3848 100644
--- a/app/views/helpers/javascript_vars.phtml
+++ b/app/views/helpers/javascript_vars.phtml
@@ -8,6 +8,15 @@ $hide_posts = ($this->conf->display_posts ||
Minz_Request::param('output') === 'reader');
$s = $this->conf->shortcuts;
+$url_login = Minz_Url::display(array(
+ 'c' => 'auth',
+ 'a' => 'login'
+), 'php');
+$url_logout = Minz_Url::display(array(
+ 'c' => 'auth',
+ 'a' => 'logout'
+), 'php');
+
echo 'var context={',
'hide_posts:', $hide_posts ? 'false' : 'true', ',',
'display_order:"', Minz_Request::param('order', $this->conf->sort_order), '",',
@@ -43,8 +52,8 @@ echo 'shortcuts={',
echo 'url={',
'index:"', _url('index', 'index'), '",',
- 'login:"', _url('index', 'login'), '",',
- 'logout:"', _url('index', 'logout'), '",',
+ 'login:"', $url_login, '",',
+ 'logout:"', $url_logout, '",',
'help:"', FRESHRSS_WIKI, '"',
"},\n";
diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml
index 109fad0eb..db25714bb 100644
--- a/app/views/helpers/view/normal_view.phtml
+++ b/app/views/helpers/view/normal_view.phtml
@@ -7,7 +7,7 @@ if (!empty($this->entries)) {
$display_today = true;
$display_yesterday = true;
$display_others = true;
- if ($this->loginOk) {
+ if (FreshRSS_Auth::hasAccess()) {
$sharing = $this->conf->sharing;
} else {
$sharing = array();
@@ -58,7 +58,7 @@ if (!empty($this->entries)) {
}
?><div class="flux<?php echo !$item->isRead() ? ' not_read' : ''; ?><?php echo $item->isFavorite() ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id(); ?>">
<ul class="horizontal-list flux_header"><?php
- if ($this->loginOk) {
+ if (FreshRSS_Auth::hasAccess()) {
if ($topline_read) {
?><li class="item manage"><?php
$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id()));
@@ -103,7 +103,7 @@ if (!empty($this->entries)) {
?>
</div>
<ul class="horizontal-list bottom"><?php
- if ($this->loginOk) {
+ if (FreshRSS_Auth::hasAccess()) {
if ($bottomline_read) {
?><li class="item manage"><?php
$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id()));
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml
index 584792e29..a59063557 100644
--- a/app/views/index/index.phtml
+++ b/app/views/index/index.phtml
@@ -2,7 +2,7 @@
$output = Minz_Request::param('output', 'normal');
-if ($this->loginOk || Minz_Configuration::allowAnonymous()) {
+if (FreshRSS_Auth::hasAccess() || Minz_Configuration::allowAnonymous()) {
if ($output === 'normal') {
$this->renderHelper('view/normal_view');
} elseif ($output === 'reader') {
diff --git a/app/views/index/login.phtml b/app/views/index/login.phtml
deleted file mode 100644
index 79fbe9d21..000000000
--- a/app/views/index/login.phtml
+++ /dev/null
@@ -1 +0,0 @@
-<?php print_r($this->res); ?>
diff --git a/app/views/index/logout.phtml b/app/views/index/logout.phtml
deleted file mode 100644
index a0aba9318..000000000
--- a/app/views/index/logout.phtml
+++ /dev/null
@@ -1 +0,0 @@
-OK \ No newline at end of file
diff --git a/app/views/users/index.phtml b/app/views/users/index.phtml
index 95659f727..f1cdf01a3 100644
--- a/app/views/users/index.phtml
+++ b/app/views/users/index.phtml
@@ -11,7 +11,7 @@
<div class="group-controls">
<input id="current_user" type="text" disabled="disabled" value="<?php echo Minz_Session::param('currentUser', '_'); ?>" />
<label class="checkbox" for="is_admin">
- <input type="checkbox" id="is_admin" disabled="disabled" <?php echo Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_')) ? 'checked="checked" ' : ''; ?>/>
+ <input type="checkbox" id="is_admin" disabled="disabled" <?php echo FreshRSS_Auth::hasAccess('admin') ? 'checked="checked" ' : ''; ?>/>
<?php echo _t('is_admin'); ?>
</label>
</div>
@@ -44,7 +44,7 @@
<label class="group-name" for="mail_login"><?php echo _t('persona_connection_email'); ?></label>
<?php $mail = $this->conf->mail_login; ?>
<div class="group-controls">
- <input type="email" id="mail_login" name="mail_login" class="extend" autocomplete="off" value="<?php echo $mail; ?>" <?php echo Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_')) ? '' : 'disabled="disabled"'; ?> placeholder="alice@example.net" />
+ <input type="email" id="mail_login" name="mail_login" class="extend" autocomplete="off" value="<?php echo $mail; ?>" <?php echo FreshRSS_Auth::hasAccess('admin') ? '' : 'disabled="disabled"'; ?> placeholder="alice@example.net" />
<noscript><b><?php echo _t('javascript_should_be_activated'); ?></b></noscript>
</div>
</div>
@@ -56,7 +56,7 @@
</div>
</div>
- <?php if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { ?>
+ <?php if (FreshRSS_Auth::hasAccess('admin')) { ?>
<legend><?php echo _t('auth_type'); ?></legend>