1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00
psyced/world/net/http/login.c

34 lines
854 B
C
Raw Normal View History

2009-01-26 20:12:53 +00:00
#include <ht/http.h>
#include <net.h>
#include <text.h>
#include <person.h>
htget(prot, query, headers, qs) {
string nick, t;
object user;
if (nick = query["user"]) user = find_person(nick);
unless (user) {
// should be a different mc here..
t = "_error_invalid_authentication_token";
} else unless (user->validToken(query["token"])) {
t = "_error_invalid_authentication_token";
} else {
PT(("replacing cookie %O\n", headers["cookie"]))
htok3(prot, 0, "Set-Cookie: psyced=\""+ qs +"\"; path=/;\n");
2009-03-07 09:30:44 +00:00
#if 1
2009-01-26 20:12:53 +00:00
// login was supposed to something more than just /surf
// but until this is the case, why lose time?
return NET_PATH "http/examine"->htget(0, query, headers, qs);
#else
t = "_PAGES_login";
2009-01-26 20:12:53 +00:00
#endif
}
htok3(prot, 0, "Expires: 0\n");
localize(query["lang"], "html");
w("_HTML_head");
w(t);
w("_HTML_tail");
return 1;
}