Reference

Guide

$user->loginPasswordless()

Logs the user in without checking the password

$user->loginPasswordless(\Session|array $session = null): void

Parameters

Name Type Default Description
$session Session|array null

Session options or session object to set the user in

Example

// simple login form submission example
if($username = get('username') and $password = get('password')) {

  $user = $kirby->user($username);

  // verify access with a different method like
  // OAuth, IndieAuth, email or SMS token etc.
  myCustomAuthProvider();

  if($user and $user->loginPasswordless()) {
    // redirect to the homepage
    // or any other page
    go();
  } else {
    echo 'login process failed';
  }

}

Source code

kirby/src/Cms/User.php#L397