Skip to content

Commit

Permalink
When opening *Quality-time*, don't show the user as logged in when th…
Browse files Browse the repository at this point in the history
…eir session has expired. Fixes #1927.
  • Loading branch information
fniessink committed Feb 23, 2021
1 parent 618ad3b commit 9e99f8b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion components/frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ class App extends Component {
const report_date_iso_string = parse(this.history.location.search).report_date || "";
const report_date_string = isValidDate_YYYYMMDD(report_date_iso_string) ? report_date_iso_string.split("-").reverse().join("-") : "";
this.login_forwardauth();
this.connect_to_nr_measurements_event_source()
this.connect_to_nr_measurements_event_source();
if (new Date(localStorage.getItem("session_expiration_datetime")) < new Date()) {
this.set_user(null) // The session expired while the user was away
}
this.setState(
{
report_uuid: report_uuid, report_date_string: report_date_string, loading: true,
Expand Down
4 changes: 2 additions & 2 deletions components/server/src/model/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def __init__(self, session_data: dict[str, Union[datetime, str]]) -> None:
def is_valid(self) -> bool:
"""Return whether the session is valid."""
expiration_datetime = cast(
datetime, self.__session_data.get("session_expiration_datetime", datetime.min.replace(tzinfo=timezone.utc))
)
datetime, self.__session_data.get("session_expiration_datetime", datetime.min)
).replace(tzinfo=timezone.utc)
return bool(expiration_datetime > datetime.now(timezone.utc))

def is_authorized(self, authorized_users: list[str]) -> bool:
Expand Down
3 changes: 2 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

<!-- The line "## <square-bracket>Unreleased</square-bracket>" is replaced by the ci/release.py script with the new release version and release date. -->

## [3.19.1-rc.1] - [2021-02-23]
## [Unreleased]

### Fixed

- When opening *Quality-time*, don't show the user as logged in when their session has expired. Fixes [#1927](https://github.com/ICTU/quality-time/issues/1927).
- When measuring the up-to-dateness of a folder in GitLab with more than 100 files or subfolders, *Quality-time* uses the GitLab pagination API to retrieve the files and subfolders in batches of 100 each. However, due to a bug, the collector component would get stuck in a loop, retrieving the same files over and over again. Fixes [#1938](https://github.com/ICTU/quality-time/issues/1938).

## [3.19.0] - [2021-02-21]
Expand Down

0 comments on commit 9e99f8b

Please sign in to comment.