I’m trying to create a login page where users can log in with their name instead of email.
How can I make this?
This is the code I use to log in with email:
// simple login form submission example
if($username = get('username') and $password = get('password')) {
$user = $kirby->user($username);
if($user and $user->login($password)) {
// redirect to the homepage
// or any other page
if(!cookie::exists('loggedin')) {
cookie::set('loggedin', 'true');
}
$url = site()->find("loggedin")->url();
go($url);
} else {
echo 'Invalid username or password';
}
}
hello jarneuyt, would you be so kind to post the final code (of your controller, i guess) to solve this? i can follow the discussion here only to a certain point and i would be happy to be able to create a username/password authentification myself…
greetings,
matthias