Example #1
0
 static function login($login, $pass)
 {
     // Authenticate using password
     $user = User::by_login($login, false);
     if ($user) {
         $user->check_password($pass);
     } else {
         if (LDAP_CREATE_USER) {
             $user = User::add_from_ldap($login, $pass);
         }
     }
     if (!$user) {
         throw new NotFoundException("User not found: {$login}");
     }
     // Done
     Authentication::set_current_user($user);
 }