We need to implement a workflow that looks like this: 1. A new patron self registers in the OPAC, with a temporary category code, including providing a social security number 2. After the data is saved, the patron is redirected to a Script (similar to opac/svc/auth/googleopenidconnect, but provided by a plugin) 3. The script redirects the patron again, to an OpenID provider, where (s)he has to login in a secure manner 4. After logging in, the user is redirected back to the Script, and the Script can tell what the correct social security number of the patron is 5. If the social security number provided by the OpenID provider matches one of a temporary patron, that patron is updated to a permanent patron We need to be able to set the URL that the user should be redirected to in step 2 above. This could be done in a couple of ways: 1. As a syspref This would be fairly simple. The syspref holds the URL and if it is set, the user is redirected at the right place in opac/opac-memberentry.pl 2. As a plugin hook The first plugin hook of the right type called would provide the URL and, if there is a URL, the patron is redirected. One advantage of the plugin hook approach is that the information about where to redirect the user would be contained in the same plugin that provides the Script. But a plugin hook does seem like a bit of overkill for providing a single, static URL. And I guess the plugin could set the syspref, if it wanted to, so I will submit a patch that uses a syspref.
Created attachment 114724 [details] [review] Bug 27312 - Add a syspref to redirect patron after self registration We have an authentication workflow that requires redirecting the patron to a URL or path after successfull self registration. See Bugzilla for further details. This patch adds a syspref that takes a full URL or local path, and if this is set, a patron will be redirected after completing the self registration in the OPAC. To test: - Apply this patch, including running the atomic database update - Enable PatronSelfRegistration and set a patron category in PatronSelfRegistrationDefaultCategory - Do a self registration in the OPAC and check it works as expeced - Fill inn a complete URL in RedirectURLAfterPatronSelfReg - Do a new self registration in the OPAC and note that you are redirected to the URL you entered - Check in the staff client that the patron was registered as expected, before being redirected - Sign off
It's an interesting idea. However, what if there are multiple authentication methods provided for a system? For instance, perhaps you have several different identity providers? We've had this scenario on more than one occasion. Perhaps it makes sense to re-direct after self-registration to opac-user.pl and to have your authentication method listed there, and then the user can choose the method that makes sense for them. (This also makes it more generalizable for other Koha libraries.) If you wanted to make it smoother and you only had 1 identity provider, perhaps you could automatically redirect again using some Javascript based on the referer...
It sounds like David's comments suggest a possible improvement but I don't think it's necessarily a blocker for the patch. I do notice that this feature doesn't work if you have PatronSelfRegistrationVerifyByEmail enabled. If that's intentional there should at least be text in the system preference description that lets the user know.