Parcourir la source

Hide registration form if max registration reached

See https://github.com/FreshRSS/FreshRSS/issues/679
Marien Fressinaud il y a 10 ans
Parent
commit
f560c44a00

+ 3 - 0
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);
+		}
 	}
 }

+ 3 - 1
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>

+ 4 - 0
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'); ?>