$user->login($password)

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

  • $password (string)
  • return (boolean)

Example

// 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
    go();
  } else {
    echo 'invalid username or password';
  }

}

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