@create $thing named Aloha GUI:Aloha GUI
@prop #102."users" {} c
;;#102.("users") = {"#103", "#103", "#103", "#103", "#103", "#103", "#103", "#103", "#103", "#103", "#103", "#103", "#103", "#103"}
@prop #102."times" {} c
;;#102.("times") = {1073637578, 1073637597, 1073637639, 1073638297, 1073638345, 1073638508, 1073638546, 1073638588, 1073638637, 1073638676, 1073638705, 1073899323, 1073899346, 1073899415}
@prop #102."passwords" {} c
;;#102.("passwords") = {"6JP9948924N7Q29F1MBG", "1814934C12A5M7P23MNQ", "FDA6P9KF31BQ4JDP3D25", "F6G7D4CH5525J547G728", "71544G5318D2KJGK1BEM", "1C84996KMG599CMFM8C8", "47F6KJ6D3N6F9PHD8323", "H4HCNABJAM4488EHPDQ1", "7F7948C7BC9Q7QF681FP", "H32DMN34P9A95A27JG6C", "53GFH41B68EQG29B42D3", "68M7D8A8PG4MFFB871C7", "6BAK329JM4KJ59EPD3NG", "G16BDG8N597NKE58485M"}
@prop #102."bad_login" {} c
;;#102.("bad_login") = {{"Tue Jan 6 00:38:06 2004 HST", "bad login", "asd", ""}, {"Tue Jan 6 00:38:29 2004 HST", "bad login", "asd", ""}, {"Tue Jan 6 00:38:42 2004 HST", "bad login", "asd", ""}, {"Tue Jan 6 00:38:51 2004 HST", "bad login", "asdas", "asd"}, {"Tue Jan 6 00:39:00 2004 HST", "bad password", "wizard", "werewr"}, {"Tue Jan 6 00:40:04 2004 HST", "bad login", "sd", ""}, {"Tue Jan 6 00:40:21 2004 HST", "bad password", "wizard", "erwerw"}, {"Tue Jan 6 18:03:24 2004 HST", "bad login", "asd", ""}, {"Tue Jan 6 18:05:15 2004 HST", "bad login", "sdf", ""}, {"Tue Jan 6 18:05:49 2004 HST", "bad login", "sdf", ""}, {"Tue Jan 6 18:06:11 2004 HST", "bad login", "dfsd", "sdf"}, {"Tue Jan 6 18:27:12 2004 HST", "bad login", "asd", ""}, {"Tue Jan 6 18:29:08 2004 HST", "bad password", "user", "usxzczczc"}, {"Tue Jan 6 20:41:47 2004 HST", "bad password", "user", ""}, {"Tue Jan 6 20:45:28 2004 HST", "bad password", "user", ""}}
;;#102.("aliases") = {"Aloha GUI"}
;;#102.("object_size") = {0, 0}
@verb #102:"login" this none this
@program #102:login
env = args[2];
page = {};
page = {@page, ""};
page = {@page, "
"};
page = {@page, $string_utils:from_list({"Login to ", $network.MOO_name, ""})};
page = {@page, " | "};
page = {@page, "
"};
page = {@page, ""};
page = {@page, ""};
$kahuna:ok(page);
.
@verb #102:"get_login" this none this
@program #102:get_login
"-- get the login information from the this:login() --";
hash = args[1];
env = args[2];
"-- Verifies login/passwd --";
username = $hash_utils:fetch(hash, "username");
password = $hash_utils:fetch(hash, "password");
screen_width = $hash_utils:fetch(hash, "screen_width");
screen_height = $hash_utils:fetch(hash, "screen_height");
conn_type = $hash_utils:fetch(hash, "type_of_conn");
if (conn_type == "user")
"-- user connection --";
user_check = $player_db:find(username);
if (!valid(user_check))
this:bad_user({username, password}, env);
endif
if (crypt(password, $string_utils:match_player(username).password) != $string_utils:match_player(username).password)
this:bad_password({username, password}, env);
else
this:clean();
auth = this:log_user(username, password);
"-- let's get the user preferences if any --";
if ($object_utils:has_property(user_check, "Aloha_frame_settings"))
"-- go fetch them!... ouarf! --";
"-- wait.. not yet --";
else
"-- it's a first time thing...!! how cute ;) --";
add_property(user_check, "Aloha_frame_Settings", {"COLS", "40", "60", "ROWS", "30", "70"}, {user_check, "c"});
endif
frame_settings = user_check.Aloha_frame_settings;
this:make_frames({auth, {{"username", username}, {"password", password}}, frame_settings}, env);
endif
else
"-- Guest connection --";
this:make_frames({{"username", "guest"}, {"password", "guest"}}, env);
endif
.
@verb #102:"random" this none this
@program #102:random
"-- generates a random key for authentication --";
string = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
key = "";
for i in [1..20]
key = key + string[random(32)];
endfor
return key;
.
@verb #102:"log_user" this none this
@program #102:log_user
"if (caller != this)";
" return E_PERM;";
"else";
"-- called by this:get_login() --";
"-- Receives login/passwd, encrypts them, logs them, and sends back the auth --";
username = args[1];
password = args[2];
this.users = {@this.users, $string_utils:from_value($player_db:find(username))};
this.times = {@this.times, time()};
passwd = this:random();
this.passwords = {@this.passwords, passwd};
key = (("username=" + $string_utils:explode($string_utils:from_value($player_db:find(username)), "#")[1]) + "&password=") + passwd;
return key;
"endif";
.
@verb #102:"clean" this none this
@program #102:clean
if (this.users)
if (length(this.times) > 1)
for i in [1..length(this.times)]
if ((this.times[i] + 1800) <= time())
this.users = listdelete(this.users, i);
this.times = listdelete(this.times, i);
this.passwords = listdelete(this.passwords, i);
break i;
endif
endfor
endif
endif
.
@verb #102:"bad_user" this none this
@program #102:bad_user
#2.tmp4 = args;
username = args[1][1];
password = args[1][2];
this.bad_login = {@this.bad_login, {ctime(), "bad login", username, password}};
env = args[2];
page = {};
page = {@page, ""};
page = {@page, "
"})}; else page = {@page, $string_utils:from_list({" | "})};
endif
page = {@page, "
"})}; else page = {@page, " Aloha Web Server"}; endif page = {@page, ""}; page = {@page, " | "};
page = {@page, "
"}; page = {@page, " | |
"}; page = {@page, " | |
"};
page = {@page, "
Bad Username"})}; page = {@page, "
"}; page = {@page, " | "};
page = {@page, " |
"};
page = {@page, ""};
page = {@page, ""};
$kahuna:ok(page);
.
@verb #102:"bad_password" this none this
@program #102:bad_password
username = args[1][1];
password = args[1][2];
this.bad_login = {@this.bad_login, {ctime(), "bad password", username, password}};
env = args[2];
page = {};
page = {@page, ""};
page = {@page, "
"})}; else page = {@page, $string_utils:from_list({" | "})};
endif
page = {@page, "
"})}; else page = {@page, " Aloha Web Server"}; endif page = {@page, ""}; page = {@page, " | "};
page = {@page, "
"}; page = {@page, " | |
"}; page = {@page, " | |
"};
page = {@page, "
Bad Password"})}; page = {@page, "
"}; page = {@page, " | "};
page = {@page, " |
"}; page = {@page, ""}; page = {@page, ""}; $kahuna:ok(page); . @verb #102:"make_frames" this none this @program #102:make_frames #2.tmp5 = args; auth = args[1][1]; hash = args[1][2]; frame_settings = args[1][3]; env = args[2]; username = $hash_utils:fetch(hash, "username"); password = $hash_utils:fetch(hash, "password"); "-- create the GET arguments --"; java_hash = (("?username=" + username) + "&password=") + password; page = {}; "-- let's display according to settings - 2 options --"; if ((frame_settings[1] == "COLS") && (frame_settings[4] == "ROWS")) page = {@page, $string_utils:from_list({"
"}; elseif ((frame_settings[1] == "ROWS") && (frame_settings[4] == "COLS")) page = {@page, $string_utils:from_list({"
| "})};
page = {@page, "
"})}; page = {@page, "Please wait for the lower frame to load..."}; page = {@page, ""}; page = {@page, "