aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-07-22 14:00:08 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-07-22 14:00:08 +0200
commitf560c44a003ca69644f8e7262dca2f8f7e6932d5 (patch)
treea3274b38758fa56c2c4647793380eec57eeab122
parent02c3546440f961018adc1e2c8e97c16f2aca18fc (diff)
Hide registration form if max registration reached
See https://github.com/FreshRSS/FreshRSS/issues/679
-rw-r--r--app/Controllers/authController.php3
-rw-r--r--app/views/auth/formLogin.phtml4
-rw-r--r--app/views/auth/personaLogin.phtml4
3 files changed, 10 insertions, 1 deletions
diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php
index 1c8ad2193..223282afb 100644
--- a/app/Controllers/authController.php
+++ b/app/Controllers/authController.php
@@ -351,5 +351,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController {
* This action gives possibility to a user to create an account.
*/
public function registerAction() {
+ if (max_registrations_reached()) {
+ Minz_Error::error(403);
+ }
}
}
diff --git a/app/views/auth/formLogin.phtml b/app/views/auth/formLogin.phtml
index 75537ee26..3a6053065 100644
--- a/app/views/auth/formLogin.phtml
+++ b/app/views/auth/formLogin.phtml
@@ -1,7 +1,9 @@
<div class="prompt">
<h1><?php echo _t('gen.auth.login'); ?></h1>
- <a href="<?php echo _url('auth', 'register'); ?>"><?php echo _t('gen.auth.register.ask'); ?></a>
+ <?php if (!max_registrations_reached()) { ?>
+ <a href="<?php echo _url('auth', 'register'); ?>"><?php echo _t('gen.auth.register.ask'); ?></a>
+ <?php } ?>
<form id="crypto-form" method="post" action="<?php echo _url('auth', 'login'); ?>">
<div>
diff --git a/app/views/auth/personaLogin.phtml b/app/views/auth/personaLogin.phtml
index 545ed2eac..91349a67e 100644
--- a/app/views/auth/personaLogin.phtml
+++ b/app/views/auth/personaLogin.phtml
@@ -2,6 +2,10 @@
<div class="prompt">
<h1><?php echo _t('gen.auth.login'); ?></h1>
+ <?php if (!max_registrations_reached()) { ?>
+ <a href="<?php echo _url('auth', 'register'); ?>"><?php echo _t('gen.auth.register.ask'); ?></a>
+ <?php } ?>
+
<p>
<a class="signin btn btn-important" href="<?php echo _url('auth', 'login'); ?>">
<?php echo _i('login'); ?> <?php echo _t('gen.auth.login_persona'); ?>