extern uint32_t hashlittle( const void *key, size_t length, uint32_t initval);
-void display_reg(int during_login);
-
/*
* Access level definitions. This is initialized from a function rather than a
* static array so that the strings may be localized.
{
StrBuf *Buf;
+ /* Did the user change his mind? Pack up and go home. */
if (havebstr("exit_action")) {
- do_logout();
+ begin_burst();
+ output_headers(1, 0, 0, 0, 1, 0);
+ do_template("authpopup_finished", NULL);
+ end_burst();
return;
}
- if (havebstr("newuser_action")) {
- Buf = NewStrBuf();
- serv_printf("OIDC %s", bstr("name"));
- StrBuf_ServGetln(Buf);
- if (GetServerStatus(Buf, NULL) == 2) {
- StrBuf *gpass;
-
- gpass = NewStrBuf();
- serv_puts("SETP GENERATE_RANDOM_PASSWORD");
- StrBuf_ServGetln(gpass);
- StrBufCutLeft(gpass, 4);
- become_logged_in(sbstr("name"), gpass, Buf);
- FreeStrBuf(&gpass);
- }
- FreeStrBuf(&Buf);
+
+ /* Ok, let's give this a try. Can we create the new user? */
+
+ Buf = NewStrBuf();
+ serv_printf("OIDC %s", bstr("name"));
+ StrBuf_ServGetln(Buf);
+ if (GetServerStatus(Buf, NULL) == 2) {
+ StrBuf *gpass;
+
+ gpass = NewStrBuf();
+ serv_puts("SETP GENERATE_RANDOM_PASSWORD");
+ StrBuf_ServGetln(gpass);
+ StrBufCutLeft(gpass, 4);
+ become_logged_in(sbstr("name"), gpass, Buf);
+ FreeStrBuf(&gpass);
}
+ FreeStrBuf(&Buf);
+ /* Did we manage to log in? If so, continue with the normal flow... */
if (WC->logged_in) {
- if (WC->need_regi) {
- display_reg(1);
- } else if (WC->need_vali) {
- validate();
- } else {
- do_welcome();
+ if (WC->logged_in) {
+ begin_burst();
+ output_headers(1, 0, 0, 0, 1, 0);
+ do_template("authpopup_finished", NULL);
+ end_burst();
}
} else {
- const StrBuf *Buf;
+ /* Still no good! Go back to teh dialog to select a username */
+ const StrBuf *Buf;
putbstr("__claimed_id", NewStrBufDup(sbstr("openid_url")));
Buf = sbstr("name");
if (StrLength(Buf) > 0)
putbstr("__username", NewStrBufDup(Buf));
begin_burst();
+ output_headers(1, 0, 0, 0, 1, 0);
+ wc_printf("<html><body>");
do_template("openid_manual_create", NULL);
+ wc_printf("</body></html>");
end_burst();
}
{
StrBuf *Buf;
wcsession *WCC = WC;
- int already_logged_in = (WCC->logged_in) ;
int linecount = 0;
StrBuf *result = NULL;
StrBuf *username = NULL;
}
}
- /* 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);
- FreeStrBuf(&password);
- FreeStrBuf(&claimed_id);
- 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.
*/
- if (!strcasecmp(ChrPtr(result), "authenticate")) {
+ else if (!strcasecmp(ChrPtr(result), "authenticate")) {
become_logged_in(username, password, logged_in_response);
+
+ /* Did we manage to log in? If so, continue with the normal flow... */
+ if (WC->logged_in) {
+ begin_burst();
+ output_headers(1, 0, 0, 0, 1, 0);
+ do_template("authpopup_finished", NULL);
+ end_burst();
+ } else {
+ begin_burst();
+ output_headers(1, 0, 0, 0, 1, 0);
+ wc_printf("<html><body>");
+ wc_printf(_("An error has occurred."));
+ wc_printf("</body></html>");
+ end_burst();
+ }
}
- /* 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.
*/
-
-/*
- * FIXME make this work again!!!!
- *
else if (!strcasecmp(ChrPtr(result), "verify_only")) {
putbstr("__claimed_id", claimed_id);
claimed_id = NULL;
username = NULL;
}
begin_burst();
+ output_headers(1, 0, 0, 0, 1, 0);
+ wc_printf("<html><body>");
do_template("openid_manual_create", NULL);
+ wc_printf("</body></html>");
end_burst();
}
-*/
-
-
- /* Did we manage to log in? If so, continue with the normal flow... */
- if (WC->logged_in) {
- begin_burst();
- output_headers(1, 0, 0, 0, 1, 0);
- do_template("authpopup_finished", NULL);
- end_burst();
- } else {
+ /* Something went VERY wrong if we get to this point */
+ else {
+ syslog(1, "finalize_openid_login() failed to do anything. This is a code problem.\n");
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();
}
FreeStrBuf(&ReturnTo);
}
- /* FIXME - don't we have to free VCMsg and VCAtt ?? */
}