Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bec8c56c authored by Akhil's avatar Akhil 🙂
Browse files

Merge branch 'revert-token-password-update' into 'nc-21'

Added patch to revert token password update

See merge request !57
parents 84eef8ea dd0f564b
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ ARG ECLOUD_LAUNCHER_JOB_ID="222001"
ARG GOOGLE_INTEGRATION_VERSION="1.0.6"

COPY patches/ ${TMP_PATCH_DIR}/
RUN sed -i 's/21,0,7,0/21,0,7,11/' ${BASE_DIR}/version.php
RUN sed -i 's/21,0,7,0/21,0,7,12/' ${BASE_DIR}/version.php

# Install unzip for unzipping artifacts
RUN apt-get update && apt-get install unzip 
@@ -109,6 +109,7 @@ RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/009-help-links.patch
RUN patch -u ${BASE_DIR}/lib/private/Updater.php -i ${TMP_PATCH_DIR}/010-disable-app-store-upgrade.patch
RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/011-privacy-settings.patch
RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dashboard/lib/Controller/DashboardController.php -i ${TMP_PATCH_DIR}/012-remove-user-status-widget.patch
RUN patch -u ${BASE_DIR}/lib/private/Authentication/Token/PublicKeyTokenProvider.php -i ${TMP_PATCH_DIR}/013-revert-token-password-update.patch
RUN rm -rf ${TMP_PATCH_DIR}

# autocomplete leak tweak apps frontend with sed, disable group suggestion
+21 −0
Original line number Diff line number Diff line
From: Akhil <akhil@e.email>
Date: Fri, 16 Dec 2021 17:30 +0530
Subject: [PATCH] Reverts token password update on each login

NC 21 started updating password of each and every token on each login. This introduces a huge load on database.
This patch reverts to only update when there are expired tokens.

--- ./lib/private/Authentication/Token/PublicKeyTokenProvider.php	2021-11-16 01:32:54.000000000 +0530
+++ ./lib/private/Authentication/Token/PublicKeyTokenProvider-new.php	2021-12-16 17:13:48.893560398 +0530
@@ -414,6 +414,11 @@
 	public function updatePasswords(string $uid, string $password) {
 		$this->cache->clear();
 
+		if (!$this->mapper->hasExpiredTokens($uid)) {
+			// Nothing to do here
+			return;
+		}
+
 		// prevent setting an empty pw as result of pw-less-login
 		if ($password === '') {
 			return;