Openbravo Issue Tracking System - POS2
View Issue Details
0047255POS2POSpublic2021-06-28 10:502021-06-28 16:20
cberner 
cberner 
highcriticalhave not tried
closedfixed 
5
 
 
Pre packaging ( pi )
2021-06-21
https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/commit/204b1a709ed0077358e345ae50063a0acb8e77da [^]
No
0047255: Profile change invalidates current session, requiring log-in again
When changing profile, the session is invalidated, making it impossible to switch profile or pay tickets without relogging. It is not possible to switch back to the previous profile either, without relogging.

This makes profile button/feature useless, as it requires marking by default a profile, instead of using the expected switch to x profile, as expected.

In backend when the profile changes this is the message that appears in tomcat log:
2021-06-28 10:39:38,095 [http-nio-8080-exec-1] ERROR org.openbravo.mobile.core.process.MobileService - CSRF token check failed. Request=/openbravo/org.openbravo.mobile.core.service.jsonrest/org.openbravo.retail.posterminal.OrderLoader, SessionID=A0A04E29ED22683F1153877A5C1CAED7, SessionToken=3F503F025D9D40629D3BFDC99098FDD5, RequestToken=8FB1701AE7E14C48B6D25C88F2E8E4A7
1. Open and login in WebPOS
2. Click on user and Profile, change it to something else
3. Try to pay a ticket, or opening profile popup again. (it will fail with a similar error as in attached screenshot)

You may reproduce it in livebuilds: https://livebuilds.openbravo.com/retail_pos2_pgsql/web/pos/?terminal=VBS-2 [^]
No tags attached.
depends on backport 0047257TAP closed cberner Profile change invalidates current session, requiring log-in again 
caused by defect 0046814 closed caristu JIRA 1730 - TerminalLogLoader - Error 401 
png localhost_3000__terminal=VBS-2(pos2) (70).png (89,409) 2021-06-28 10:50
https://issues.openbravo.com/file_download.php?file_id=15965&type=bug
png
Issue History
2021-06-28 10:50cbernerNew Issue
2021-06-28 10:50cbernerAssigned To => platform
2021-06-28 10:50cbernerFile Added: localhost_3000__terminal=VBS-2(pos2) (70).png
2021-06-28 10:50cbernerResolution time => 1625436000
2021-06-28 10:50cbernerTriggers an Emergency Pack => No
2021-06-28 10:50cbernerStatusnew => acknowledged
2021-06-28 10:50cbernerAssigned Toplatform => cberner
2021-06-28 10:52cbernerDescription Updatedbug_revision_view_page.php?rev_id=22795#r22795
2021-06-28 12:09cbernerNote Added: 0129851
2021-06-28 13:11cbernerStatusacknowledged => scheduled
2021-06-28 13:25hgbotNote Added: 0129853
2021-06-28 15:29hgbotResolutionopen => fixed
2021-06-28 15:29hgbotStatusscheduled => closed
2021-06-28 15:29hgbotNote Added: 0129856
2021-06-28 15:29hgbotNote Added: 0129857
2021-06-28 16:12caristuRelationship addedcaused by 0046814
2021-06-28 16:19cbernerRegression level => Coding ( Testing )
2021-06-28 16:19cbernerRegression date => 2021-06-21
2021-06-28 16:20cbernerRegression levelCoding ( Testing ) => Pre packaging ( pi )
2021-06-28 16:20cbernerRegression introduced by commit => https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/commit/204b1a709ed0077358e345ae50063a0acb8e77da [^]

Notes
(0129851)
cberner   
2021-06-28 12:09   
This is a regression introduced by this commit: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/commit/204b1a709ed0077358e345ae50063a0acb8e77da [^]
(0129853)
hgbot   
2021-06-28 13:25   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/574 [^]
(0129856)
hgbot   
2021-06-28 15:29   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2 [^]
Changeset: c26dab3c58d030fab5c26a3cc04b4bf6c765e6b0
Author: Cristian Berner <cristian.berner@openbravo.com>
Date: 2021-06-28T13:19:36+02:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/commit/c26dab3c58d030fab5c26a3cc04b4bf6c765e6b0 [^]

Fixes ISSUE-47255: Profile change invalidates current session, requiring login again

Profile change removes the current session, resulting in it being
invalidated. However, after that restore session is executed(by
refreshing the window), it should take care of recovering the previous
session and adding new information, like for example the csrf token.

The problem is, InitializeAppData has been modified to only saving csrf token
on login, which is not always the case. If the session or token changes
between a refresh of the application, it is necessary to retrieve the
new one, without requiring to do login.

This commit fixes it by reverting the change done in
InitializeAppData(which removed saving csrf token). Now CSRF token is
saved in savePreRenderActionsResponse function and as such it is
possible to retrieve it in restore session flow, which also fixes the
profile change issue.

---
M web-jspack/org.openbravo.core2/src/components/AppBar/ProfileSelector/__test__/ProfileSelector.test.jsx
M web-jspack/org.openbravo.core2/src/core/authentication/InitializeAppData.js
M web-jspack/org.openbravo.core2/src/core/authentication/__test__/RestoreSession.test.js
---
(0129857)
hgbot   
2021-06-28 15:29   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/574 [^]