Restored the ability to associate an OpenID with an existing account.
authorArt Cancro <ajc@citadel.org>
Tue, 1 Feb 2011 04:45:50 +0000 (23:45 -0500)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 14:13:11 +0000 (14:13 +0000)
webcit/auth.c
webcit/openid.c

index cb5ea4b473a6cb3a1721b917711889e4026765db..5e01bb5fe53f86ce3a0d827f6e56e25279bd2fc5 100644 (file)
@@ -276,7 +276,6 @@ void finalize_openid_login(void)
 {
        StrBuf *Buf;
        wcsession *WCC = WC;
-       int already_logged_in = (WCC->logged_in) ;
        int linecount = 0;
        StrBuf *result = NULL;
        StrBuf *username = NULL;
@@ -336,9 +335,10 @@ void finalize_openid_login(void)
                }
        }
 
-       /* If we were already logged in, this was an attempt to associate an OpenID account 
-       FIXME put this back in
-       if (already_logged_in) {
+       /*
+        * Is this an attempt to associate a new OpenID with an account that is already logged in?
+        */
+       if ( (WCC->logged_in) && (havebstr("attach_existing")) ) {
                display_openids();
                FreeStrBuf(&result);
                FreeStrBuf(&username);
@@ -347,7 +347,6 @@ void finalize_openid_login(void)
                FreeStrBuf(&logged_in_response);
                return;
        }
-       */
 
        /* If this operation logged us in, either by connecting with an existing account or by
         * auto-creating one using Simple Registration Extension, we're already on our way.
@@ -356,7 +355,7 @@ void finalize_openid_login(void)
                become_logged_in(username, password, logged_in_response);
        }
 
-       /* The specified OpenID was verified but the desired user name was either not specified via SRI
+       /* The specified OpenID was verified but the desired user name was either not specified via SRE
         * or conflicts with an existing user.  Either way the user will need to specify a new name.
         */
 
@@ -388,7 +387,7 @@ void finalize_openid_login(void)
                begin_burst();
                output_headers(1, 0, 0, 0, 1, 0);
                wc_printf("<html><body>");
-               wc_printf(_("An error has occurred."));         /* FIXME do something prettier here */
+               wc_printf(_("An error has occurred."));
                wc_printf("</body></html>");
                end_burst();
        }
@@ -728,7 +727,6 @@ void display_reg(int during_login)
                FreeStrBuf(&ReturnTo);
        }
 
-       /* FIXME - don't we have to free VCMsg and VCAtt ?? */
 }
 
 
index 8ab2cb4ced73fe0f28d83569a228c47363e8e530..28af729227eaf57b9f63f21435ae9b1b8da6481a 100644 (file)
@@ -67,7 +67,7 @@ void openid_attach(void) {
                syslog(LOG_DEBUG, "Attempting to attach %s\n", bstr("openid_url"));
 
                snprintf(buf, sizeof buf,
-                       "OIDS %s|%s/finalize_openid_login|%s",
+                       "OIDS %s|%s/finalize_openid_login?attach_existing=1|%s",
                        bstr("openid_url"),
                        ChrPtr(site_prefix),
                        ChrPtr(site_prefix)