/*
- * WebcitAuth; Handles authentication of users to a Citadel server.
+ * These functions handle authentication of users to a Citadel server.
*
* Copyright (c) 1996-2010 by the citadel.org team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * This program is open source software. You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "webcit.h"
FreeStrBuf(&Buf);
}
+
+
+/*
+ * modal/ajax version of 'login' (username and password)
+ */
+void ajax_login_username_password(void) {
+ StrBuf *Buf;
+
+ serv_printf("USER %s", bstr("name"));
+ StrBuf_ServGetln(Buf);
+ if (GetServerStatus(Buf, NULL) == 3) {
+ serv_printf("PASS %s", bstr("pass"));
+ StrBuf_ServGetln(Buf);
+ if (GetServerStatus(Buf, NULL) == 2) {
+ become_logged_in(sbstr("name"), sbstr("pass"), Buf);
+ wc_printf("FIXME success");
+ }
+ }
+
+ wc_printf("FIXME %s", ChrPtr(Buf));
+
+ FreeStrBuf(&Buf);
+}
+
+
+
/*
* Try to create an account manually after an OpenID was verified
*/
serv_puts(buf);
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
- lprintf(CTDL_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
+ syslog(LOG_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
http_redirect(&buf[4]);
return;
}
return;
}
- wc_printf("<div class=\"fix_scrollbar_bug\">"
- "<table class=\"auth_validate\"><tr><td>\n");
+ wc_printf("<table class=\"auth_validate\"><tr><td>\n");
wc_printf("<div id=\"validate\">");
safestrncpy(user, &buf[4], sizeof user);
wc_printf("<br />\n");
wc_printf("</div>\n");
- wc_printf("</td></tr></table></div>\n");
+ wc_printf("</td></tr></table>\n");
wDumpContent(1);
}
WebcitAddUrlHandler(HKEY("finalize_openid_login"), "", 0, finalize_openid_login, ANONYMOUS);
WebcitAddUrlHandler(HKEY("openid_manual_create"), "", 0, openid_manual_create, ANONYMOUS);
WebcitAddUrlHandler(HKEY("do_logout"), "", 0, do_logout, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);
+ WebcitAddUrlHandler(HKEY("ajax_login_username_password"), "", 0, ajax_login_username_password, AJAX);
WebcitAddUrlHandler(HKEY("validate"), "", 0, validate, 0);
WebcitAddUrlHandler(HKEY("display_reg"), "", 0, _display_reg, 0);
WebcitAddUrlHandler(HKEY("display_changepw"), "", 0, display_changepw, 0);
WebcitAddUrlHandler(HKEY("changepw"), "", 0, changepw, 0);
WebcitAddUrlHandler(HKEY("termquit"), "", 0, do_logout, 0);
+
RegisterConditional(HKEY("COND:AIDE"), 2, ConditionalAide, CTX_NONE);
RegisterConditional(HKEY("COND:LOGGEDIN"), 2, ConditionalIsLoggedIn, CTX_NONE);
RegisterConditional(HKEY("COND:MAY_CREATE_ROOM"), 2, ConditionalHaveAccessCreateRoom, CTX_NONE);