Jelajahi Sumber

Fix login (#5271)

Fix https://github.com/FreshRSS/FreshRSS/issues/5270
Alexandre Alapetite 3 tahun lalu
induk
melakukan
b6ac505f8f
3 mengubah file dengan 9 tambahan dan 6 penghapusan
  1. 1 1
      app/Controllers/feedController.php
  2. 3 3
      lib/Minz/Request.php
  3. 5 2
      lib/Minz/Url.php

+ 1 - 1
app/Controllers/feedController.php

@@ -800,7 +800,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
 				break;
 			default:
 				$redirect_url = Minz_Request::paramString('r', true);
-				if ($redirect_url !== '') {
+				if ($redirect_url == '') {
 					$redirect_url = array('c' => 'subscription', 'a' => 'index');
 				}
 				if (!Minz_Request::isPost()) {

+ 3 - 3
lib/Minz/Request.php

@@ -374,12 +374,12 @@ class Minz_Request {
 
 	/**
 	 * Relance une requête
-	 * @param array{'c'?:string,'a'?:string,'params'?:array<string,mixed>} $url l'url vers laquelle est relancée la requête
+	 * @param string|array{'c'?:string,'a'?:string,'params'?:array<string,mixed>} $url l'url vers laquelle est relancée la requête
 	 * @param bool $redirect si vrai, force la redirection http
 	 *                > sinon, le dispatcher recharge en interne
 	 */
-	public static function forward(array $url = [], bool $redirect = false): void {
-		if (empty(Minz_Request::originalRequest()) && strpos('auth', json_encode($url)) !== false) {
+	public static function forward($url = [], bool $redirect = false): void {
+		if (empty(Minz_Request::originalRequest())) {
 			self::$originalRequest = $url;
 		}
 

+ 5 - 2
lib/Minz/Url.php

@@ -127,8 +127,11 @@ class Minz_Url {
 		return $url_checked;
 	}
 
-	/** @param array<string,string|array<string,string>> $url */
-	public static function serialize(array $url = []): string {
+	/** @param array<string,string|array<string,string>>|null $url */
+	public static function serialize(?array $url = []): string {
+		if (empty($url)) {
+			return '';
+		}
 		try {
 			return base64_encode(json_encode($url, JSON_THROW_ON_ERROR));
 		} catch (\Throwable $exception) {