Reference

Guide

$user->loginPasswordless()

Logs the user in without checking the password

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

Parameters

Name Type Default Description
$session Kirby\Session\Session|array null

Session options or session object to set the user in

Example

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

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

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

    // now that that succeeded, log the user in without checking the provided password
    // NOTE: Only use this if you have verified access in other ways like in this example!
    $user->loginPasswordless();

    // redirect to the homepage
    // or any other page
    go();
  } else {
    echo 'login process failed';
  }

}

Source code

kirby/src/Cms/User.php#L426