1you_lose_msg = "Either that person does not exist, or has a different password.";
2if (!(caller in {#0, this}))
3  return E_PERM;
4  "...caller isn't :do_login_command...";
5elseif (args && (args[1] == "test"))
6  return this:test(@listdelete(args, 1));
7elseif (!(length(args) in {1, 2}))
8  notify(player, tostr("Usage:  ", verb, " <existing-player-name> <password>"));
9elseif (!valid(candidate = this:_match_player(name = strsub(args[1], " ", "_"))))
10  if (name == "guest")
11    "must be no guests";
12    this:notify_lines(this:registration_text("guest"));
13  else
14    notify(player, you_lose_msg);
15  endif
16  "...unknown player...";
17elseif (is_clear_property(candidate, "password") || ((typeof(candidate.password) == STR) && ((length(candidate.password) < 2) || (crypt({@args, ""}[2], candidate.password) != candidate.password))))
18  notify(player, you_lose_msg);
19  "...bad password...";
20  server_log(tostr("FAILED CONNECT: ", args[1], " (", candidate, ") on ", connection_name(player), ($string_utils:connection_hostname(connection_name(player)) in candidate.all_connect_places) ? "" | "******"));
21elseif (((candidate.name == "guest") && this.sitematch_guests) && valid(foreigner = $country_db:get_guest()))
22  notify(player, tostr("Okay,...  Logging you in as `", foreigner:name(), "'"));
23  this:record_connection(foreigner);
24  return foreigner;
25elseif ((parent(candidate) == $guest) && (!valid(candidate = candidate:defer())))
26  if (candidate == #-3)
27    notify(player, "Sorry, guest characters are not allowed from your site right now.");
28  elseif (candidate == #-2)
29    this:notify_lines(this:registration_text("blacklisted", "Sorry, guest characters are not allowed from your site."));
30  elseif (candidate == #-4)
31    this:notify_lines(this:registration_text("guest"));
32  else
33    notify(player, "Sorry, all of our guest characters are in use right now.");
34  endif
35else
36  if ((!(name in candidate.aliases)) && (name != tostr(candidate)))
37    notify(player, tostr("Okay,... ", name, " is in use.  Logging you in as `", candidate:name(), "'"));
38  endif
39  if (this:is_newted(candidate))
40    notify(player, "");
41    notify(player, this:newt_message_for(candidate));
42    notify(player, "");
43  else
44    this:record_connection(candidate);
45    if (verb[1] == "s")
46      candidate.use_do_command = 0;
47    endif
48    return candidate;
49  endif
50endif
51return 0;