Improve login page

- if user cannot log in, a 403 error is showed (and it is done in controller)
- 403 error message has been changed to match with the error
- add blank spaces on persona login page
This commit is contained in:
Marien Fressinaud
2014-02-15 12:25:06 +01:00
parent a34941f418
commit cddec2d76f
8 changed files with 93 additions and 74 deletions

View File

@@ -351,6 +351,11 @@ class FreshRSS_index_Controller extends Minz_ActionController {
}
$this->view->_useLayout(false);
Minz_Request::forward(array('c' => 'index', 'a' => 'index'), true);
} elseif (!Minz_Configuration::canLogIn()) {
Minz_Error::error (
403,
array ('error' => array (Minz_Translate::t ('access_denied')))
);
}
invalidateHttpCache();
}

View File

@@ -3,6 +3,7 @@
return array (
// LAYOUT
'login' => 'Login',
'login_with_persona' => 'Login with Persona',
'logout' => 'Logout',
'search' => 'Search words or #tags',
'search_short' => 'Search',
@@ -276,7 +277,7 @@ return array (
'logs_empty' => 'Log file is empty',
'clear_logs' => 'Clear the logs',
'forbidden_access' => 'Access forbidden! (%s)',
'forbidden_access' => 'Access is forbidden!',
'login_required' => 'Login required:',
'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!',

View File

@@ -3,6 +3,7 @@
return array (
// LAYOUT
'login' => 'Connexion',
'login_with_persona' => 'Connexion avec Persona',
'logout' => 'Déconnexion',
'search' => 'Rechercher des mots ou des #tags',
'search_short' => 'Rechercher',
@@ -276,7 +277,7 @@ return array (
'logs_empty' => 'Les logs sont vides',
'clear_logs' => 'Effacer les logs',
'forbidden_access' => 'Accès interdit ! (%s)',
'forbidden_access' => 'Laccès vous est interdit !',
'login_required' => 'Accès protégé par mot de passe :',
'confirm_action' => 'Êtes-vous sûr(e) de vouloir continuer ? Cette action ne peut être annulée !',

View File

@@ -3,7 +3,15 @@
<h1 class="alert-head"><?php echo $this->code; ?></h1>
<p>
<?php echo Minz_Translate::t ('page_not_found'); ?><br />
<?php
switch(Minz_Request::param ('code')) {
case 403:
echo Minz_Translate::t ('forbidden_access');
break;
case 404:
default:
echo Minz_Translate::t ('page_not_found');
} ?><br />
<a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
</p>
</div>

View File

@@ -1,34 +1,32 @@
<div class="prompt">
<?php
if (Minz_Configuration::canLogIn()) {
?><h1><?php echo Minz_Translate::t('login'); ?></h1><?php
<h1><?php echo Minz_Translate::t('login'); ?></h1><?php
switch (Minz_Configuration::authType()) {
case 'form':
?><form id="loginForm" method="post" action="<?php echo _url('index', 'formLogin'); ?>">
<div>
<label for="username"><?php echo Minz_Translate::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" />
</div>
<div>
<label for="passwordPlain"><?php echo Minz_Translate::t('password'); ?></label>
<input type="password" id="passwordPlain" required="required" />
<input type="hidden" id="challenge" name="challenge" /><br />
<noscript><strong><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></strong></noscript>
</div>
<div>
<button id="loginButton" type="submit" class="btn btn-important"><?php echo Minz_Translate::t('login'); ?></button>
</div>
</form><?php
break;
case 'form':
?><form id="loginForm" method="post" action="<?php echo _url('index', 'formLogin'); ?>">
<p>
<label for="username"><?php echo Minz_Translate::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" />
</p><p>
<label for="passwordPlain"><?php echo Minz_Translate::t('password'); ?></label>
<input type="password" id="passwordPlain" required="required" />
<input type="hidden" id="challenge" name="challenge" /><br />
<noscript><strong><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></strong></noscript>
</p><p>
<button id="loginButton" type="submit" class="btn btn-important"><?php echo Minz_Translate::t('login'); ?></button>
</p>
</form><?php
break;
case 'persona':
?><p>
<?php echo FreshRSS_Themes::icon('login'); ?>
<a class="signin" href="#"><?php echo Minz_Translate::t('login_with_persona'); ?></a>
</p><?php
break;
} ?>
case 'persona':
?><p><?php echo FreshRSS_Themes::icon('login'); ?> <a class="signin" href="#"><?php echo Minz_Translate::t('login'); ?></a></p><?php
break;
}
} else {
?><h1>FreshRSS</h1>
<p><?php echo Minz_Translate::t('forbidden_access', Minz_Configuration::authType()); ?></p><?php
}
?>
<p><a href="<?php echo _url('index', 'about'); ?>"><?php echo Minz_Translate::t('about_freshrss'); ?></a></p>
<p><a href="<?php echo _url('index', 'about'); ?>"><?php echo Minz_Translate::t('about_freshrss'); ?></a></p>
</div>

View File

@@ -512,18 +512,20 @@ input, select, textarea {
}
/* Prompt (centré) */
.prompt > h1, .prompt > p {
text-align:center;
}
.prompt > form {
margin:1em auto 2.5em auto;
width:10em;
}
.prompt .btn {
display:block;
margin:.5em auto;
}
.prompt input {
margin:.4em auto 1.1em auto;
width:99%;
.prompt {
text-align: center;
}
.prompt label {
text-align: left;
}
.prompt form {
margin: 1em auto 2.5em auto;
width: 10em;
}
.prompt input {
margin: .4em auto 1.1em auto;
width: 100%;
}
.prompt p {
margin: 20px 0;
}

View File

@@ -515,18 +515,20 @@ input, select, textarea {
}
/* Prompt (centré) */
.prompt > h1, .prompt > p {
text-align:center;
}
.prompt > form {
margin:1em auto 2.5em auto;
width:10em;
}
.prompt .btn {
display:block;
margin:.5em auto;
}
.prompt input {
margin:.4em auto 1.1em auto;
width:99%;
.prompt {
text-align: center;
}
.prompt label {
text-align: left;
}
.prompt form {
margin: 1em auto 2.5em auto;
width: 10em;
}
.prompt input {
margin: .4em auto 1.1em auto;
width: 100%;
}
.prompt p {
margin: 20px 0;
}

View File

@@ -528,18 +528,20 @@ input, select, textarea {
}
/* Prompt (centré) */
.prompt > h1, .prompt > p {
text-align:center;
}
.prompt > form {
margin:1em auto 2.5em auto;
width:10em;
}
.prompt .btn {
display:block;
margin:.5em auto;
}
.prompt input {
margin:.4em auto 1.1em auto;
width:99%;
.prompt {
text-align: center;
}
.prompt label {
text-align: left;
}
.prompt form {
margin: 1em auto 2.5em auto;
width: 10em;
}
.prompt input {
margin: .4em auto 1.1em auto;
width: 100%;
}
.prompt p {
margin: 20px 0;
}