9 * Display the OpenIDs associated with an account
11 void display_openids(void)
16 output_headers(1, 1, 1, 0, 0, 0);
18 wprintf("<div class=\"fix_scrollbar_bug\">");
20 svput("BOXTITLE", WCS_STRING, _("Manage Account/OpenID Associations"));
21 do_template("beginbox");
23 wprintf("<table class=\"altern\">");
26 serv_getln(buf, sizeof buf);
27 if (buf[0] == '1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
29 wprintf("<tr class=\"%s\">", (bg ? "even" : "odd"));
30 wprintf("<td><img src=\"static/openid-small.gif\"></td><td>");
33 wprintf("<a href=\"openid_detach?id_to_detach=");
35 wprintf("\" onClick=\"return confirm('%s');\">",
36 _("Do you really want to delete this OpenID?"));
37 wprintf("%s</a>", _("(delete)"));
38 wprintf("</td></tr>\n");
41 wprintf("</table><br />\n");
43 wprintf("<form method=\"POST\" action=\"openid_attach\">\n");
44 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
45 wprintf(_("Add an OpenID: "));
46 wprintf("<input type=\"text\" name=\"openid_url\" class=\"openid_urlarea\" size=\"40\">\n");
47 wprintf("<input type=\"submit\" name=\"attach_button\" value=\"%s\">"
48 "</form></center>\n", _("Attach"));
49 do_template("endbox");
56 * Attempt to attach an OpenID to an existing, logged-in account
58 void openid_attach(void) {
61 if (havebstr("attach_button")) {
62 lprintf(CTDL_DEBUG, "Attempting to attach %s\n", bstr("openid_url"));
64 snprintf(buf, sizeof buf,
65 "OIDS %s|%s://%s/finalize_openid_login|%s://%s",
67 (is_https ? "https" : "http"), WC->http_host,
68 (is_https ? "https" : "http"), WC->http_host
72 serv_getln(buf, sizeof buf);
74 lprintf(CTDL_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
75 http_redirect(&buf[4]);
80 /* If we get to this point then something failed. */
86 * Detach an OpenID from the currently logged-in account
88 void openid_detach(void) {
91 if (havebstr("id_to_detach")) {
92 serv_printf("OIDD %s", bstr("id_to_detach"));
93 serv_getln(buf, sizeof buf);
95 strcpy(WC->ImportantMessage, &buf[4]);