Login the user with the given password if the password matches the user's password.

  • $password (string)
  • return (boolean)


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

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

  if($user and $user->login($password)) {
    // redirect to the homepage
    // or any other page
  } else {
    echo 'invalid username or password';


// put the login form with username and
// password field down here.

Is something missing or incorrect? Edit this page on Github…