File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -731,10 +731,22 @@ private function checkTokenCredentials(IToken $dbToken, $token) {
731731 return false ;
732732 }
733733
734- // If the token password is no longer valid mark it as such
735734 if ($ this ->manager ->checkPassword ($ dbToken ->getLoginName (), $ pwd ) === false ) {
735+ // If the decrypted password is empty or not a valid local password,
736+ // but the user exists and is enabled, we DO NOT permanently invalidate the token.
737+ // This prevents tokens generated via OCC or used in SSO environments
738+ // from being killed after 5 minutes
739+ if (empty ($ pwd ) || $ this ->manager ->get ($ dbToken ->getLoginName ()) !== null ) {
740+ $ this ->logger ->warning ('Password check failed for user {user}, but user is active. Token preserved. ' , [
741+ 'app ' => 'core ' ,
742+ 'user ' => $ dbToken ->getLoginName (),
743+ ]);
744+ return false ;
745+ }
746+
747+ // Legitimate password change or invalid user
748+ // Invalidate the token
736749 $ this ->tokenProvider ->markPasswordInvalid ($ dbToken , $ token );
737- // User is logged out
738750 return false ;
739751 }
740752
You can’t perform that action at this time.
0 commit comments