Public alpha, why not.

This commit is contained in:
flash 2018-02-11 17:52:50 +01:00
parent cc0bbb43d8
commit 95ec65d20a
2 changed files with 0 additions and 18 deletions

View file

@ -95,28 +95,16 @@ class AuthController extends Controller
public function register() public function register()
{ {
$app = Application::getInstance(); $app = Application::getInstance();
$allowed_to_reg = $app->config->get('Testing', 'public_registration', 'bool', false)
|| in_array(
IP::remote(),
explode(' ', $app->config->get('Testing', 'allow_ip_registration', 'string', '127.0.0.1 ::1'))
);
if ($_SERVER['REQUEST_METHOD'] === 'GET') { if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$twig = $app->templating; $twig = $app->templating;
$twig->vars([ $twig->vars([
'has_registrations' => $this->hasRegistrations(), 'has_registrations' => $this->hasRegistrations(),
'allowed_to_register' => $allowed_to_reg,
]); ]);
return $twig->render('auth.register'); return $twig->render('auth.register');
} }
if (!$allowed_to_reg) {
return [
'error' => "Nice try, but you'll have to wait a little longer. I appreciate your excitement though!"
];
}
if ($this->hasRegistrations()) { if ($this->hasRegistrations()) {
return [ return [
'error' => "Someone already used an account from this IP address!\r\n" 'error' => "Someone already used an account from this IP address!\r\n"

View file

@ -6,8 +6,6 @@
<h1 style="align-self: center; text-align: left; flex-grow: 1; padding-left: 2em"> <h1 style="align-self: center; text-align: left; flex-grow: 1; padding-left: 2em">
{% if has_registrations %} {% if has_registrations %}
Your IP address already has an account! Your IP address already has an account!
{% elseif not allowed_to_register %}
You'll have to wait a little longer!
{% else %} {% else %}
Welcome, thanks for dropping by! Welcome, thanks for dropping by!
{% endif %} {% endif %}
@ -19,10 +17,6 @@
<div class="platform" style="text-align: left;"> <div class="platform" style="text-align: left;">
<p>As a temporary security measure we only allow one account per IP address, this will definitely be changed in the future but for now; sorry for the possible inconvenience!</p> <p>As a temporary security measure we only allow one account per IP address, this will definitely be changed in the future but for now; sorry for the possible inconvenience!</p>
</div> </div>
{% elseif not allowed_to_register %}
<div class="platform" style="text-align: left;">
<p>You'll be able to register once the site enter public beta!</p>
</div>
{% else %} {% else %}
<div class="platform form" id="auth-form"> <div class="platform form" id="auth-form">
<div> <div>