X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fopenid%2Fserv_openid_rp.c;h=b74a3f88653ae5ed20143430128c9111235667b8;hb=4b70719359d4be829a4a78f2198a9da61f36f652;hp=0729c62de02722893a3a8e2be2c5d8add4096685;hpb=7918457330dd8ccfe0f2fdb5aa4f642409031573;p=citadel.git diff --git a/citadel/modules/openid/serv_openid_rp.c b/citadel/modules/openid/serv_openid_rp.c index 0729c62de..b74a3f886 100644 --- a/citadel/modules/openid/serv_openid_rp.c +++ b/citadel/modules/openid/serv_openid_rp.c @@ -181,6 +181,31 @@ void cmd_oidl(char *argbuf) { } +/* + * Create a new user account, manually specifying the name, after successfully + * verifying an OpenID (which will of course be attached to the account) + */ +void cmd_oidc(char *argbuf) { + struct ctdl_openid *oiddata = (struct ctdl_openid *) CC->openid_data; + + if (!oiddata->verified) { + cprintf("%d You have not verified an OpenID yet.\n", ERROR); + return; + } + + /* We can make the semantics of OIDC exactly the same as NEWU, simply + * by _calling_ cmd_newu() and letting it run. Very clever! + */ + cmd_newu(argbuf); + + /* Now, if this logged us in, we have to attach the OpenID */ + if (CC->logged_in) { + attach_openid(&CC->user, oiddata->claimed_id); + } +} + + + /* * Detach an OpenID from the currently logged in account @@ -778,6 +803,7 @@ CTDL_MODULE_INIT(openid_rp) CtdlRegisterProtoHook(cmd_oidf, "OIDF", "Finalize OpenID authentication"); CtdlRegisterProtoHook(cmd_oidl, "OIDL", "List OpenIDs associated with an account"); CtdlRegisterProtoHook(cmd_oidd, "OIDD", "Detach an OpenID from an account"); + CtdlRegisterProtoHook(cmd_oidc, "OIDC", "Create a new user after validating an OpenID"); CtdlRegisterSessionHook(openid_cleanup_function, EVT_LOGOUT); CtdlRegisterUserHook(openid_purge, EVT_PURGEUSER); } @@ -785,7 +811,3 @@ CTDL_MODULE_INIT(openid_rp) /* return our Subversion id for the Log */ return "$Id$"; } - - -/* FIXME ... we have to add the new openid database to serv_vandelay.c */ -