{
char buf[4096];
- if (havebstr("language")) {
- set_selected_language(bstr("language"));
- go_selected_language();
- }
+ snprintf(buf, sizeof buf,
+ "OIDS %s|%s/finalize_openid_login|%s",
+ bstr("openid_url"),
+ ChrPtr(site_prefix),
+ ChrPtr(site_prefix)
+ );
- if (havebstr("exit_action")) {
- do_logout();
+ serv_puts(buf);
+ serv_getln(buf, sizeof buf);
+ if (buf[0] == '2') {
+ syslog(LOG_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
+ http_redirect(&buf[4]);
return;
}
- if (havebstr("login_action")) {
- snprintf(buf, sizeof buf,
- "OIDS %s|%s/finalize_openid_login|%s",
- bstr("openid_url"),
- ChrPtr(site_prefix),
- ChrPtr(site_prefix)
- );
-
- serv_puts(buf);
- serv_getln(buf, sizeof buf);
- if (buf[0] == '2') {
- syslog(LOG_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
- http_redirect(&buf[4]);
- return;
- }
- else {
- display_login();
- return;
- }
- }
- /* If we get to this point then something failed. */
- display_login();
+ convenience_page("770000", _("Error"), &buf[4]);
}
+
/*
* Complete the authentication using OpenID
* This function handles the positive or negative assertion from the user's Identity Provider
$('authbox_openid').style.display = 'none';
$(show_which_div).style.display = 'block';
}
+
+
+/*
+ * Pop out a window for external auth methods
+ * (most of them don't handle inline auth very well)
+ */
+function do_auth_popout(popout_url) {
+ window.open(popout_url, "authpopout", "status=1,toolbar=0,width=600,height=400");
+}
+
+
+/*
+ * Attempt login with OpenID, called from modal dialog
+ */
+function ajax_try_openid() {
+ $('login_errmsg').innerHTML = "";
+ openid_url = encodeURI($('ajax_openid_form').elements["openid_url"].value);
+ do_auth_popout("openid_login?openid_url=" + openid_url);
+}
+