Front end login

@texnixe Thanks for the hint. From the error logs I already suspected a routing issue but I couldn’t think of a solution.

I found a tip on https://getkirby.com/docs/cookbook/i18n/filter-by-language.
However adding that to my login controller doesn’t seem to work.
Here is what I tried in the login controller:

<?php

$translatedPages = page('login')->children()->filter(function ($child) {
  return $child->translation(kirby()->language()->code())->exists();
});

return function ($kirby) {

  // don't show the login screen to already logged in users
  if ($kirby->user()) {
    go('/');
  }

  $error = false;

  // handle the form submission
  if ($kirby->request()->is('POST') && get('login')) {

    // fetch the user by username and run the
    // login method with the password
    if ($user = $kirby->user(get('username')) && $user->login(get('password'))) {
      // redirect to the homepage
      // if the login was successful
      go('/');
    } else {
      // make sure the alert is
      // displayed in the template
      $error = true;
    }

  }

  return [
    'error' => $error
  ];

};

In the multilingual template I received from Florian Kueker I have seen similar code in e.g. the blog controller:

$all_articles = $page->children()->listed()->filter(function ($child) { return $child->translation(kirby()->language()->code())->exists(); })->sortBy('date')->flip();

However I don’t know in which place in the login controller I should add the filter, and how.
Little bit stuck with this to be honest. Also spent already quite some time to get basic functionality like a login to work.

I am wondering why multilingual setup is so difficult to implement.
Found also Filter child pages by available translations where this was discussed for #kirby-2. Perhaps i can use a site-wide filtering?