Bug 20480

Summary: Fix styling issues on bad SCI/SCO module logins
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: AuthenticationAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: dpavlin, jonathan.druart
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 12904, 15492    
Bug Blocks:    
Attachments: Bug 20480: Make KOHA_VERSION available to all templates in all circumstances
Bug 20480: send KOHA_VERSION even if only one language is enabled
Bug 20480: send KOHA_VERSION even if only one language is enabled
Bug 20480: Make KOHA_VERSION available to all templates in all circumstances
Bug 20480: send KOHA_VERSION even if only one language is enabled

Description Tomás Cohen Arazi 2018-03-27 14:44:09 UTC
When one of this modules is tried, with either wrong credentials or a user without access, the Auth.pm code short-circuits to the login page, but the KOHA_VERSION template param is never set.
Comment 1 Tomás Cohen Arazi 2018-03-27 15:01:31 UTC
Created attachment 73319 [details] [review]
Bug 20480: Make KOHA_VERSION available to all templates in all circumstances

This patch makes C4::Templates::gettemplate set the KOHA_VERSION param
for the template. This way this template parameter, which is required by
(probably) all pages that include CSS/JS content is available in all
circumstances.

A noticeable problem with the current approach is when using the SCO and
SCI modules with wrong/forbidden users: C4::Auth short-circuits and
redirects to the login page, without setting the KOHA_VERSION param.
This patch solves it for good.

To test:
- Enable the SCI module
- Open the browser at
  http://localhost:8080/cgi-bin/koha/sci/sci-main.pl
- Login with the db user (koha_kohadev / password)
=> FAIL: Login failure, but styling is broken
- Apply this patch
- Retry
=> SUCCESS: Everything looks as it should!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Jonathan Druart 2018-03-27 16:27:43 UTC
Created attachment 73330 [details] [review]
Bug 20480: send KOHA_VERSION even if only one language is enabled
Comment 3 Kyle M Hall 2018-03-27 16:31:06 UTC
Created attachment 73332 [details] [review]
Bug 20480: send KOHA_VERSION even if only one language is enabled

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Kyle M Hall 2018-03-27 16:32:14 UTC
Created attachment 73333 [details] [review]
Bug 20480: Make KOHA_VERSION available to all templates in all circumstances

This patch makes C4::Templates::gettemplate set the KOHA_VERSION param
for the template. This way this template parameter, which is required by
(probably) all pages that include CSS/JS content is available in all
circumstances.

A noticeable problem with the current approach is when using the SCO and
SCI modules with wrong/forbidden users: C4::Auth short-circuits and
redirects to the login page, without setting the KOHA_VERSION param.
This patch solves it for good.

To test:
- Enable the SCI module
- Open the browser at
  http://localhost:8080/cgi-bin/koha/sci/sci-main.pl
- Login with the db user (koha_kohadev / password)
=> FAIL: Login failure, but styling is broken
- Apply this patch
- Retry
=> SUCCESS: Everything looks as it should!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall 2018-03-27 16:32:22 UTC
Created attachment 73334 [details] [review]
Bug 20480: send KOHA_VERSION even if only one language is enabled

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Jonathan Druart 2018-03-27 16:45:08 UTC
Pushed to master for 18.05