Bug 37324

Summary: Self registration complete login form won't login user
Product: Koha Reporter: Jan Kissig <bibliothek>
Component: OPACAssignee: Jan Kissig <bibliothek>
Status: Needs documenting --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: trivial    
Priority: P5 - low CC: david, fridolin.somers, lucas, m.de.rooy, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes the login form after completing self registration in the OPAC - the prefilled login details now let you log in.
Version(s) released in:
24.11.00,24.05.04
Circulation function:
Attachments: Bug 37324: Self registration complete login form won't login user
Bug 37324: Self registration complete login form won't login user
Bug 37324: Self registration complete login form won't login user
Bug 37324: Self registration complete login form won't login user

Description Jan Kissig 2024-07-11 07:42:19 UTC
When using self registration in opac and filling out the requested fields you are forwarded to a login. Either this is prefilled or you can enter the credentials provided on the same site. 

When clicking login opac-user.pl opens showing a login form. The user we just created is not logged in.

To recreate:
a) open http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationDefaultCategory
b) set PatronSelfRegistration o allow
c) set PatronSelfRegistrationDefaultCategory to Self registration
d) logout  or open a private tab
e) http://localhost:8080/cgi-bin/koha/opac-memberentry.pl and enter required fields
d) Registration complete! appears with a prefilled login form. Click Log in.
e) Check you are not logged in
Comment 1 Jan Kissig 2024-07-11 08:15:18 UTC
Created attachment 168778 [details] [review]
Bug 37324: Self registration complete login form won't login user

This patch fixes the self registration complete login form which appears after a complete self registration process.

To test:
a) open http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationDefaultCategory
b) set PatronSelfRegistration to allow
c) set PatronSelfRegistrationDefaultCategory to Self registration
d) logout or open a private tab
e) http://localhost:8080/cgi-bin/koha/opac-memberentry.pl and enter required fields
f) Registration complete! appears with a prefilled login form. Click Log in.
g) Check you are not logged in

apply patch and redo steps e-f and check that login worked.
Comment 2 David Nind 2024-07-14 22:55:05 UTC
The patch doesn't apply - sha1/fake ancestor error:

git bz apply 37324

Bug 37324 - Self registration complete login form won't login user

168778 - Bug 37324: Self registration complete login form won't login user

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 37324: Self registration complete login form won't login user
error: sha1 information is lacking or useless (koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-confirmation.tt).
error: could not build fake ancestor
Patch failed at 0001 Bug 37324: Self registration complete login form won't login user
Comment 3 Katrin Fischer 2024-07-15 07:46:08 UTC
I am not sure if this change is right:
-                                            <input class="form-control" type="text" id="userid" size="10" name="userid" value="" autocomplete="off" />
+                                            <input class="form-control" type="text" id="userid" size="10" name="login_userid" value=""

The auto-complete was added intentionally to avoid the browser completing the password field with - in some cases - someone else's password I believe.
Comment 4 Katrin Fischer 2024-07-15 07:49:38 UTC
I was thinking about bugs similar to Bug 29025
Comment 5 Jan Kissig 2024-07-15 08:02:16 UTC
(In reply to Katrin Fischer from comment #3)
> I am not sure if this change is right:
> -                                            <input class="form-control"
> type="text" id="userid" size="10" name="userid" value="" autocomplete="off"
> />
> +                                            <input class="form-control"
> type="text" id="userid" size="10" name="login_userid" value=""
> 
> The auto-complete was added intentionally to avoid the browser completing
> the password field with - in some cases - someone else's password I believe.

The only changes I made were userid to login_userid and password to login_password. 

The prefilled form is caused by system preference PatronSelfRegistrationPrefillForm
Comment 6 Katrin Fischer 2024-07-15 08:04:14 UTC
True, but why is it necessary to remove the auto-complete?
Comment 7 Katrin Fischer 2024-07-15 08:05:03 UTC
(In reply to Katrin Fischer from comment #6)
> True, but why is it necessary to remove the auto-complete?

Argh. I am sorry. I totally misread the patch line. It's all good!
Comment 8 Jan Kissig 2024-07-15 11:03:11 UTC
Created attachment 168969 [details] [review]
Bug 37324: Self registration complete login form won't login user

This patch fixes the self registration complete login form which appears after a complete self registration process.

To test:
a) open http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationDefaultCategory
b) set PatronSelfRegistration to allow
c) set PatronSelfRegistrationDefaultCategory to Self registration
d) logout or open a private tab
e) http://localhost:8080/cgi-bin/koha/opac-memberentry.pl and enter required fields
f) Registration complete! appears with a prefilled login form. Click Log in.
g) Check you are not logged in

apply patch and redo steps e-f and check that login worked.
Comment 9 Jan Kissig 2024-07-15 11:05:15 UTC
(In reply to David Nind from comment #2)
> The patch doesn't apply - sha1/fake ancestor error:
> 
> git bz apply 37324
> 
> Bug 37324 - Self registration complete login form won't login user
> 
> 168778 - Bug 37324: Self registration complete login form won't login user
> 
> Apply? [(y)es, (n)o, (i)nteractive] y
> Applying: Bug 37324: Self registration complete login form won't login user
> error: sha1 information is lacking or useless
> (koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-confirmation.tt).
> error: could not build fake ancestor
> Patch failed at 0001 Bug 37324: Self registration complete login form won't
> login user

I was on signing off #33766 when I opened this bug. Now applying should work
Comment 10 David Nind 2024-07-16 04:09:08 UTC
Created attachment 169035 [details] [review]
Bug 37324: Self registration complete login form won't login user

This patch fixes the self registration complete login form which appears after a complete self registration process.

To test:
a) open http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationDefaultCategory
b) set PatronSelfRegistration to allow
c) set PatronSelfRegistrationDefaultCategory to Self registration
d) logout or open a private tab
e) http://localhost:8080/cgi-bin/koha/opac-memberentry.pl and enter required fields
f) Registration complete! appears with a prefilled login form. Click Log in.
g) Check you are not logged in

apply patch and redo steps e-f and check that login worked.

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 David Nind 2024-07-16 04:12:12 UTC
(In reply to Jan Kissig from comment #9)

> I was on signing off #33766 when I opened this bug. Now applying should work

Thanks Jan for fixing! Now signed off.
Comment 12 Marcel de Rooy 2024-07-19 09:04:44 UTC
Created attachment 169184 [details] [review]
Bug 37324: Self registration complete login form won't login user

This patch fixes the self registration complete login form which appears after a complete self registration process.

To test:
a) open http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationDefaultCategory
b) set PatronSelfRegistration to allow
c) set PatronSelfRegistrationDefaultCategory to Self registration
d) logout or open a private tab
e) http://localhost:8080/cgi-bin/koha/opac-memberentry.pl and enter required fields
f) Registration complete! appears with a prefilled login form. Click Log in.
g) Check you are not logged in

apply patch and redo steps e-f and check that login worked.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 13 Marcel de Rooy 2024-07-19 09:06:40 UTC
Related to CSRF changes
Comment 14 Martin Renvoize (ashimema) 2024-07-22 09:41:01 UTC
Thanks for all the hard work!

Pushed to main for the next 24.11.00 release as RM Assistant
Comment 15 Lucas Gass (lukeg) 2024-08-28 20:01:08 UTC
Backported to 24.05.x for upcoming 24.05.04
Comment 16 Fridolin Somers 2024-09-10 13:30:21 UTC
"cud-" not in 23.11.x