Bug 29480 - Add email address as a method for generating the userid when self registering in OPAC
Summary: Add email address as a method for generating the userid when self registering...
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low new feature (vote)
Assignee: Andreas Jonsson
QA Contact: Testopia
URL:
Keywords:
: 2237 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-11-15 11:44 UTC by Andreas Jonsson
Modified: 2023-03-29 12:55 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 29480: Add new systempreference PatronSelfRegistrationUseridGenerationMethod and add email as option. (5.58 KB, patch)
2021-11-15 12:16 UTC, Andreas Jonsson
Details | Diff | Splinter Review
Bug 29480: Add new systempreference PatronSelfRegistrationUseridGenerationMethod and add email as option. (7.27 KB, patch)
2021-11-16 07:14 UTC, Andreas Jonsson
Details | Diff | Splinter Review
Bug 29480: Add new systempreference PatronSelfRegistrationUseridGenerationMethod and add email as option. (7.46 KB, patch)
2022-10-19 08:58 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 29480: (follow up) Use "patron", not "borrower" (3.09 KB, patch)
2022-10-19 08:58 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 29480: (follow up) Add tests to subtest generate_userid (3.89 KB, patch)
2022-10-19 08:58 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 29480: (follow up) Update POD for generate_userid() (1.57 KB, patch)
2022-10-19 09:06 UTC, Magnus Enger
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Jonsson 2021-11-15 11:44:20 UTC
- Add a system preference for selecting a method for generating the userid when self registering
- Fall back to the default method (firstname.surname[uniqueness identifier when needed])
Comment 1 Andreas Jonsson 2021-11-15 12:16:59 UTC
Created attachment 127636 [details] [review]
Bug 29480: Add new systempreference PatronSelfRegistrationUseridGenerationMethod and add email as option.

Test plan

- Install patch and run koha-upgrade-schema <instance>
- The systempreference PatronSelfRegistrationUseridGenerationMethod should be found in the adminstrative interface under OPAC -> Self registration and modification
- Also make sure
- Make sure that PatronSelfRegistration is set to Allow and  PatronSelfRegistrationDefaultCategory is set to an existing borrower category
- Make sure that PatronSelfModificationBorrowerUnwantedField doesn't prevent the input of an email address in the self registration form.  (I.e., make sure "email" is NOT selected for exclusion.)
- Go to opac and self register a patron and verify that the userid is on the form firstname.surname.
- Change systempreference to 'email'
- Go to OPAC and self register a patron and make sure to add a valid email address.
- Verify the that the userid is the email adress.
- Go to OPAC and self register a patron using the SAME valid email adress as above (to provoke a conflicting userid).
- Verify that the userid is on the form firstname.surname.
Comment 2 David Cook 2021-11-15 23:14:57 UTC
Andreas, can you set yourself as assignee?

I might be wrong but I think sysprefs.sql needs updating too.
Comment 3 Andreas Jonsson 2021-11-16 07:14:01 UTC
Created attachment 127679 [details] [review]
Bug 29480: Add new systempreference PatronSelfRegistrationUseridGenerationMethod and add email as option.

Test plan

- Install patch and run koha-upgrade-schema <instance>
- The systempreference PatronSelfRegistrationUseridGenerationMethod should be found in the adminstrative interface under OPAC -> Self registration and modification
- Also make sure
- Make sure that PatronSelfRegistration is set to Allow and  PatronSelfRegistrationDefaultCategory is set to an existing borrower category
- Make sure that PatronSelfModificationBorrowerUnwantedField doesn't prevent the input of an email address in the self registration form.  (I.e., make sure "email" is NOT selected for exclusion.)
- Go to opac and self register a patron and verify that the userid is on the form firstname.surname.
- Change systempreference to 'email'
- Go to OPAC and self register a patron and make sure to add a valid email address.
- Verify the that the userid is the email adress.
- Go to OPAC and self register a patron using the SAME valid email adress as above (to provoke a conflicting userid).
- Verify that the userid is on the form firstname.surname.
Comment 4 Andreas Jonsson 2021-11-16 07:16:25 UTC
Yes, I had missed to add the system preference to sysprefs.sql.  Thank you David for pointing this out!
Comment 5 Jonathan Druart 2021-12-15 09:50:09 UTC
Please provide tests.
Comment 6 Jonathan Druart 2021-12-15 09:50:32 UTC
You also need to rename 'borrower' with 'patron'.
Comment 7 Magnus Enger 2022-10-18 13:30:48 UTC
The POD for generate_userid() should be updated.
Comment 8 Magnus Enger 2022-10-19 08:58:06 UTC
Created attachment 142133 [details] [review]
Bug 29480: Add new systempreference PatronSelfRegistrationUseridGenerationMethod and add email as option.

Test plan

- Install patch and run koha-upgrade-schema <instance>
- The systempreference PatronSelfRegistrationUseridGenerationMethod should be found in the adminstrative interface under OPAC -> Self registration and modification
- Also make sure
- Make sure that PatronSelfRegistration is set to Allow and  PatronSelfRegistrationDefaultCategory is set to an existing borrower category
- Make sure that PatronSelfModificationBorrowerUnwantedField doesn't prevent the input of an email address in the self registration form.  (I.e., make sure "email" is NOT selected for exclusion.)
- Go to opac and self register a patron and verify that the userid is on the form firstname.surname.
- Change systempreference to 'email'
- Go to OPAC and self register a patron and make sure to add a valid email address.
- Verify the that the userid is the email adress.
- Go to OPAC and self register a patron using the SAME valid email adress as above (to provoke a conflicting userid).
- Verify that the userid is on the form firstname.surname.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised. I will provide followups for the issues
that have been pointed out.
Comment 9 Magnus Enger 2022-10-19 08:58:12 UTC
Created attachment 142134 [details] [review]
Bug 29480: (follow up) Use "patron", not "borrower"

Also changes "user name" to "userid".
Comment 10 Magnus Enger 2022-10-19 08:58:18 UTC
Created attachment 142135 [details] [review]
Bug 29480: (follow up) Add tests to subtest generate_userid
Comment 11 Magnus Enger 2022-10-19 09:06:54 UTC
Created attachment 142136 [details] [review]
Bug 29480: (follow up) Update POD for generate_userid()

Add an explanation of how PatronSelfRegistrationUseridGenerationMethod
will affect behaviour.
Comment 12 Marcel de Rooy 2022-10-19 13:01:17 UTC
Please use the new style for an atomic update:

use Modern::Perl;

return {
    bug_number => "BUG_NUMBER",
    description => "A single line description",
    up => sub {
        my ($args) = @_;
        my ($dbh, $out) = @$args{qw(dbh out)};
        # Do you stuffs here
        $dbh->do(q{});
        # Print useful stuff here
        say $out "Update is going well so far";
    },
};

See skeleton file in the atomicupdate folder.
Comment 13 Marcel de Rooy 2022-10-19 13:08:07 UTC
Functional question about:

+If PatronSelfRegistrationUseridGenerationMethod is set to 'email', the email
+address will be used as the userid. If the patron being created has no email,
+or the patron has an email address that is already in use by another patron,
+the default way of creating the userid ($firstname.$surname) will be used.

Is that really what you want? If my email address is already in the database, I probably dont want another account.
One of the issues we face is actually that impatient people register 2 or 3 accounts.

There is a security aspect too. You do not want to offer a way to check if an email address is present. So it might be safer to send a verification mail to the email address specified that either gives you a link to proceed or tells you that there is an account already. The OPAC could just say: check your mail, and not reveal the information.

What do you think?
Comment 14 Katrin Fischer 2022-11-14 23:09:03 UTC
(In reply to Marcel de Rooy from comment #13)
> Functional question about:
> 
> +If PatronSelfRegistrationUseridGenerationMethod is set to 'email', the email
> +address will be used as the userid. If the patron being created has no
> email,
> +or the patron has an email address that is already in use by another patron,
> +the default way of creating the userid ($firstname.$surname) will be used.
> 
> Is that really what you want? If my email address is already in the
> database, I probably dont want another account.
> One of the issues we face is actually that impatient people register 2 or 3
> accounts.

We see this for families where the email address of the parents is used in the children's accounts as well. Also sometimes for internal accounts where a library address might be used several times. Some academic libraries also do separate accounts for 'permanent loans'.

Maybe display a warning or so instead of not allowing it?
Comment 15 Marcel de Rooy 2022-11-15 12:26:13 UTC
(In reply to Katrin Fischer from comment #14)
> (In reply to Marcel de Rooy from comment #13)
> > Functional question about:
> > 
> > +If PatronSelfRegistrationUseridGenerationMethod is set to 'email', the email
> > +address will be used as the userid. If the patron being created has no
> > email,
> > +or the patron has an email address that is already in use by another patron,
> > +the default way of creating the userid ($firstname.$surname) will be used.
> > 
> > Is that really what you want? If my email address is already in the
> > database, I probably dont want another account.
> > One of the issues we face is actually that impatient people register 2 or 3
> > accounts.
> 
> We see this for families where the email address of the parents is used in
> the children's accounts as well. Also sometimes for internal accounts where
> a library address might be used several times. Some academic libraries also
> do separate accounts for 'permanent loans'.
> 
> Maybe display a warning or so instead of not allowing it?

Maybe a lax or strict mode or so? Obviously you dont need to use email as userid, but if you do, it might be nice to choose between fallback to name based userid or not allowing it..
Comment 16 Marcel de Rooy 2022-12-08 08:06:15 UTC
*** Bug 2237 has been marked as a duplicate of this bug. ***
Comment 17 Marcel de Rooy 2022-12-08 08:18:37 UTC
On bug 32426 I will give the plugin approach a try in getting this long standing enh req further.
Comment 18 Marcel de Rooy 2023-02-20 11:55:08 UTC
(In reply to Marcel de Rooy from comment #17)
> On bug 32426 I will give the plugin approach a try in getting this long
> standing enh req further.

Submitted some patches on that report now.
Comment 19 Marcel de Rooy 2023-03-29 12:55:23 UTC
Please note that the plugin approach on bug 32426 has been pushed now. This allows you to move your code to a Koha plugin.